U.S. President Joe Biden on Friday accused the U.S. oil industry, and Exxon Mobil Corp in particular, of capitalizing on a supply shortage to fatten profits after a report showed inflation surging to a new 40-year record.

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. A gallon of regular gasoline cost an average $4.99 nationwide on Friday, according to motorist group AAA.

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 with oil and gas prices, pointing to the gains as evidence consumers are paying for more than higher labor and shipping costs.

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

Share buybacks improve earnings per share by reducing the number of shares outstanding, indirectly helping to boost share prices. Companies see buybacks as a way to reward investors.

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

Exxon pushed back at the comments, noting it has continued to increase its U.S. oil, gasoline and diesel production, and had borrowed heavily to increase output while suffering losses in 2020.

"We have been in regular contact with the administration, informing them of our planned investments to increase production and expand refining capacity in the United States," said spokesman Casey Norton.

Exxon will hike spending 50% in its West Texas shale holdings, he said, where it expects to add 25% more output this year after adding 190,000 barrels to oil production last year. An ongoing Texas refinery expansion will add the equivalent of a "new medium sized refinery," said Norton.

Exxon, the largest U.S. oil producer, lost some $20 billion in 2020, and had borrowed more than $30 billion to finance operations. It paid $40.6 billion in taxes last year, $17.8 billion more than in 2020, he said.

The president spoke during a visit to the Port of Los Angeles, where he defended his economic and job creation record and deflected blame for inflation, which spiked 8.6% in the year to May according to a new Labor Department report.

In a Democratic campaign fundraising event in Beverly Hills that evening, Biden sounded a cautious tone about the prospects for inflation going forward: "We're gonna live with this inflation for a while," he said. "It's gonna come down gradually, but we're going to live with it for a while."

Biden earlier had 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. After halting share buybacks several years ago, it resumed them this year and pledged to spend up to $30 billion through next year.

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 in his Friday remarks urged Congress to pass legislation to cut energy, prescription drugs and shipping costs.

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.