Inflation is currently at historic levels, with gas prices reaching an all-time high of $4.331 in March and continuing to increase to their current record-high of $4.432 per gallon as of May 13. However, high prices aren't bad for everyone. While American consumers struggle to adapt to skyrocketing energy costs, oil companies and their investors are winning big.

In 2022 alone, crude oil prices have risen more than 40%, largely driven by the Russian invasion of Ukraine. Following the invasion, prices hit $130 per barrel, but they have since receded to just over $100 per barrel. For reference, the average crude oil price in the U.S. in 2021 was $70.68. 2020, meanwhile, was a historically bad year for energy companies, with a yearly average cost of just $41.96 per barrel.

The high prices have helped ExxonMobil (XOM  ), the largest oil company in the U.S., rake in more than $5.5 billion in net profit, more than double the amount it made during the same period last year, and just two years after the company saw its highest losses in decades during the peak of the pandemic.

These big wins are coming despite the fact that many energy companies faced losses when they pulled out of Russia after the invasion began. Exxon, for example, exited positions in Russia worth nearly $4 billion.

Along with Exxon, Chevron (CVX  ) reported that its 2022 first-quarter profits are the highest it's seen in almost a decade, and Shell's (SHEL  ) earnings are the highest it's ever made.

"The bottom line is that the industry is generating the highest free cash flow certainly in the 25 years that I've looked at this business," Doug Leggate, the head of Bank of America's (BAC  ) oil and gas equity research team, said.

Along with high investor dividends, the record profits are expected to result in significant share buybacks, with Exxon planning to buy back $30 billion in shares by the end of 2023, three times its prior projection.

The gas companies and their investors might be happy, but Democratic lawmakers are not. Just last month, oil executives were called to a Congressional hearing to defend their price increases, increases that Democrats described as price gouging.

The executives strongly denied the accusation of price gouging, and energy experts point to the fact that gas prices are subject to global crude prices, making price gouging less likely.

The price may be outside of oil executives' control, but production is slightly more malleable. The Biden administration is pushing big oil to ramp up production, but the companies aren't likely to make any major changes due to pressure from investors, supply chain issues, and staffing constraints.