U.S. President Joe Biden on Friday accused the U.S. oil industry, and ExxonMobil in particular, of capitalizing on a supply shortage to fatten profits.

U.S. consumer inflation accelerated in May as gasoline prices hit a record high and the cost of food soared, leading to the largest annual increase in four decades.

Biden, who came into office vowing to reduce U.S. dependence on fossil fuels, said on Friday he was hoping to speed up oil production, which is expected to hit record highs in the United States next year.

But he also issued a warning to the industry, whose profits have jumped as it increased prices, in a sign that consumers are paying for more than just higher labor and shipping costs.

"Exxon made more money than God this year," Biden said in a speech to dockworkers and union representatives at the Port of Los Angeles. U.S. oil companies are not using profits to drill more but to buy back stock, he added.

"Why aren't they drilling? Because they make more money not producing more oil," he said. "Exxon, start investing and start paying your taxes."

In a statement earlier Friday about May inflation data, Biden chided U.S. oil, gas and refining industries for using "the challenge created by the war in Ukraine as a reason to make things worse for families with excessive profit-taking or price hikes."

Exxon posted its biggest quarterly profit in seven years when it reported fourth-quarter earnings in February. Shell reported record first-quarter profits in May, while Chevron Corp and BP posted their best numbers in a decade.

Other majors, including TotalEnergies, as well as U.S. independent shale operators, reported strong figures as the industry's biggest players concentrate on share repurchases and dividend investments.

Numerous companies have said they are holding down spending that could boost oil output to lower $100-plus per barrel oil prices, because that is what investors are demanding.

The surging costs have become a political headache for the Biden administration, which has tried several measures to lower prices. These include a record release of barrels from U.S. strategic reserves, waivers on rules related to the production of summer gasoline, and leaning on major OPEC countries to boost output.

Biden also urged Congress to pass legislation to cut costs of energy bills, prescription drugs and shipping.

Shipping companies made $190 billion in profit, a seven-fold increase in one year, Biden said at the port. The situation made him so "viscerally angry" that he wanted to "pop them," he said.