Marathon Petroleum's oil refinery in Anacortes, Wash., March 9.

Photo: DAVID RYDER/REUTERS

After a long year of pain at the pump, gasoline prices have come down to earth. That may seem a reason to be cheery as 2023 approaches, but retail prices are likely to remain elevated for a simple reason: America’s lack of refining capacity.

Consumers don’t buy crude oil. They buy gasoline, diesel and heating oil, which are produced in specialized oil refineries. Since the beginning of 2020, seven refineries, totaling almost 6% of U.S. capacity, have closed. A million barrels a day have been taken out of the market. Large and small refineries have ceased operations. No region has been spared, with closures reaching from the East Coast, which serves the most consumers, to the refining hub of the Gulf Coast.

In California, the state with the costliest gasoline on average, the price at the pump is down more than $2 in the past six months. Still, the prices in California are 33% higher than the national average and 63% higher than prices in Texas. Gov. Gavin Newsom seems intent on ensuring there is no future relief for Californians, as he raids the profits that refiners could otherwise have used to improve capacity.

What capacity remains is contracting. The Tesoro refinery in the Bay Area city of Martinez has closed in anticipation of conversion to a renewable-fuels plant, taking more than 160,000 barrels per day out of the supply chain. The renewable-fuels plant will replace less than a third of that capacity.

A similar fate befell the country’s second-newest refinery, in Dickinson, N.D., as firms struggle to take advantage of government incentives for ethanol. America’s remaining refineries are having to run harder to make up the difference.

The Biden administration gives itself credit for falling gas prices, claiming that sales from the Strategic Petroleum Reserve have provided some relief to consumers. But the lack of U.S. refining capacity is so severe that the releases had to be exported to Italy and Asia. Without the ability to process higher production, prices are likely to spike again next year.

While the administration has lately begun encouraging domestic and even foreign oil production, it has done nothing to relieve pressure on American refiners. If anything, the administration has made life harder for refiners by increasing the amount of ethanol that must be blended into gasoline under the Renewable Fuel Standard.

Given the White House’s stated desire to lead a transition away from fossil fuels, refiners are concerned that long-term demand for their products will dry up. You can hardly blame them for thinking twice about making new investments in the U.S.

The ability of U.S. refiners to process lower-grade crude into valuable products such as diesel and jet fuel is an asset in the global marketplace. Manufacturing jobs in oil refining provide economic stability along with energy security. Even on the environmental ledger, U.S. refiners perform better than those in other countries.

Rather than vilifying and undermining the refining sector, the Biden administration should find ways to encourage further improvements. Instead, badgering refiners seems to be federal policy. Investing some of the year’s profits in medium-term capacity can help U.S. consumers. Foreign countries are making these investments and hurrying to bring new, modern refining capacity online.

This holiday season may feel like a reprieve, but consumers shouldn’t bank on significantly lower gas prices in the future. Oil isn’t going away anytime soon. The world won’t stop using it for decades, which means that the pain at the pump will still continue indefinitely until Washington decides to get serious about expanding domestic refining capacity.

Mr. Fitzgerald is an associate professor of business economics at Texas Tech University. He served as chief international economist at the White House Council of Economic Advisers, 2017-18.