Canadian oil is selling at bargain prices, good news for the two Twin Cities refineries that supply much of Minnesota's gasoline, but not necessarily for drivers.

While gasoline consumers have gotten a break in recent weeks as the price of U.S. oil has sunk 20 percent after hitting a four-year high, those in Minnesota might have seen a bigger price drop had companies that use mostly Canadian crude passed on their savings.

The difference between the prices of heavy Canadian oil and U.S. light crude has hit $50 a barrel in recent weeks, a historically high spread. Canadian crude feeds refineries in the Midwest and Great Lakes region, particularly in Minnesota.

"These two refineries in the Minneapolis area are in a terrific position," said Patrick DeHaan, head of petroleum analysis at GasBuddy.com, a fuel price tracking firm. "It's 'Let the good times roll.' "

"The [Canadian oil] discount you are seeing is primarily going to their bottom lines," he said.

While Minnesota gas prices have fallen 9 percent since the beginning of October — 2 percentage points more than the national average — retailers generally aren't profiting from the Canadian oil discount, and neither are consumers, DeHaan said.

Friday's average price in Minnesota was just under $2.62 per gallon compared with the national average of about $2.71.

Canadian heavy oil on average makes up about 80 percent of the crude refined at Flint Hills Resources' big Pine Bend refinery in Rosemount. Canadian crude has accounted for as much as 50 percent of oil used in recent years at the refinery in St. Paul Park, recently bought by Marathon Petroleum.

Jake Reint, a spokesman for Flint Hills, which supplies about 50 percent of Minnesota's gasoline, acknowledged that weak Canadian oil prices are a plus for any refinery that uses crude from Alberta.

"But that advantage comes with significant investments needed to refine that crude," he said.

Heavy Canadian crude costs more to squeeze into fuel than light sweet oil, the U.S. mainstay. It contains more sulfur and requires a more complicated refining process. Flint Hills, owned by Wichita-based Koch Industries, has spent around $2 billion in the last decade to improve the efficiency of its heavy crude refining, Reint said.

Still, "refineries are in the catbird's seat," said Sandy Fielden, a stock analyst at Morningstar. "They have a license to print money because they are buying crude cheap."

ExxonMobil, Phillips 66 and BP all posted strong quarterly earnings in the past two weeks, buoyed by rising refining profits. Discounted Canadian oil, as well as lower prices on oil produced in west Texas, played a key role.

Marathon Petroleum's earnings missed analysts' forecasts, but its profits were still boosted by low-cost Canadian oil. And company executives noted in a Nov. 1 conference call that Marathon is upping its purchases of Canadian crude.

"On discounts, we're bullish," Rick Hessling, a senior vice president, told stock analysts on the call. "We see all-time high production in Canada." He noted that Ohio-based Marathon can take an even greater advantage of the Canadian discount now that it owns the St. Paul Park refinery.

Marathon scooped up the refinery in a $23 billion buyout of Andeavor, which closed Oct. 1, creating the nation's largest oil refiner. The St. Paul Park refinery, which supplies the region's SuperAmerica stations, can process around 100,000 barrels of oil per day, about one-third of Pine Bend's capacity.

The extra cost of processing lower-quality Canadian crude — combined with the cost of transporting it from northern Alberta — leads to a price discount even in normal times.

The spread between Western Canadian Select (WCS) and West Texas Intermediate (WTI) — two respective Canadian and U.S. benchmark prices — generally has been $14 to $16 a barrel over the past few years, said Kevin Birn, a crude oil analyst in Calgary at IHS Markit, a market researcher.

The spread widened to around $25 a barrel late last year and into early 2018 after a Canadian oil pipeline leaked in South Dakota, temporarily shutting down its flow. The Canadian discount tightened up in the summer, but the gap came roaring back this fall, culminating in a $50 a barrel difference between WCS and WTI last month.

The reason: a "punishing combination" of persistent transportation bottlenecks for Canadian oil, record high Canadian oil production and several North American refinery "outages," according to a recent report by Rystad Energy, a global consulting company.

Outages are planned refinery shutdowns that last at least a few weeks. Some large Midwest refineries were down in September and October, weakening demand for Canadian crude and thus putting more downward pressure on its price.

The transportation tie-up is partly due to the paucity of rail cars available this fall to haul oil. But the lack of oil pipeline capacity from Canada into the United States is the most critical issue, and it's a long-term problem.

"The situation is one that has been a long time coming," IHS' Birn said. "What surprised everybody is how quickly it happened."

The solution, to the oil industry, is more pipelines. There are three transborder Canadian pipelines in the works; all have faced considerable opposition and two are in limbo. A federal judge in Montana on Thursday rejected the Trump administration's permit for the much-delayed Keystone XL pipeline.

But Calgary-based Enbridge won approval in June from Minnesota regulators for its new pipeline across the state. Enbridge still hasn't got all of its permits, but it expects to begin construction early next year on the project, a replacement for its current Line 3 that can only run at about half capacity because of corrosion and other problems caused by its age. The oil industry is counting on it to be completed by the end of 2019.

Right now, all U.S. gasoline consumers are benefiting as oil inventories build. Production from major oil-producing nations, including the United States, is growing. Oil demand forecasts have weakened as well.

But GasBuddy's DeHaan said the current downturn in oil prices — and gasoline prices — isn't sustainable.

"Fill up and enjoy it," he said. "I believe that 2019 is not going to be as kind as 2018 for [gasoline] prices, and 2018 hasn't been that kind."

As for the Canadian factor? Analysts expect the Canadian discount to stay high and its benefits to continue accruing mostly to refiners.

Mike Hughlett • 612-673-7003