Five years ago, Delta Air Lines (NYSE:DAL) made the unusual decision to buy a refinery, to protect against the risk of high crack spreads -- the difference between the cost of crude oil and the cost of refined products like jet fuel.

Many energy-market analysts thought Delta was making a big mistake, and that it didn't have the expertise necessary to run a refinery. Yet while Delta's Trainer, Pa., refinery has had its ups and downs, it has earned a good rate of return overall. Most importantly, it has proved effective at insulating Delta from fluctuations in crack spreads. In the wake of Hurricane Harvey, Delta is set to capitalize on its refinery bet once again.

A bumpy road

When Delta bought its refinery in early 2012, the company estimated that it would contribute annual pre-tax profits of about $300 million. However, that proved to be an overly ambitious target.

A Delta Air Lines plane on the ground.

Delta Air Lines is the only airline to own an oil refinery. Image source: Delta Air Lines.

Delta started on the wrong foot, as Superstorm Sandy caused some damage to the refinery and forced it to slow production. Soon thereafter, crack spreads plummeted, denting refining margins. As a result, the refinery lost money in both 2012 and 2013. It turned profitable in 2014, though, and earnings peaked at nearly $300 million in 2015.

Last year, the refinery fell back into the red, posting a full-year loss of $125 million. The impact of lower crack spreads was exacerbated by rising environmental compliance costs. 2017 has been better, though. The refinery posted a solid $44 million profit in Q1, followed by a $6 million profit in Q2, even though environmental compliance costs continued rising.

Crack spreads just surged

As of July, Delta expected to earn a full-year profit of less than $100 million for the refinery. While that's far less than Delta's initial estimate of the refinery's profit potential, it would still represent a strong return on the company's investment of about $250 million, including costs to refurbish the plant.

However, Hurricane Harvey has completely changed the economics of Delta's refinery, albeit temporarily. South Texas is the epicenter of the U.S. refining industry, and catastrophic flooding in the region has taken about a quarter of U.S. refining capacity offline.

As a result, the Gulf Coast crack spread -- which had already risen modestly since the beginning of July -- has more than doubled compared to the levels prevailing in the first half of the year. The so-called "3:2:1" crack spread reached $31.38 per barrel at the end of trading on Thursday.

Meanwhile, Delta's refinery wasn't impacted, because it is located in Pennsylvania. This will allow it to earn windfall profits until the market gets back into equilibrium. Based on the Trainer refinery's capacity of 182,000 barrels per day, a $16-per-barrel jump in the crack spread would boost its profit by $3 million per day.

For now, Delta has a big advantage

Five years ago, Delta's refinery was on the wrong end of Superstorm Sandy. This time around, it is profiting from chaos in a different part of the country.

There's no way to know how long it will take for refining margins to return to normal. However, the current consensus among experts is that it could take weeks for Texas refineries to get back to normal production levels. Supply of refined products could remain tight until then, keeping the crack spread well above normal levels. This situation could boost Delta's refinery profit for the year by $100 million or more, offsetting the impact of any increase in market prices for jet fuel.

By contrast, other airlines have no choice but to pay the prevailing jet fuel spot price. To the extent that airlines hedge their fuel costs, they typically hedge against changes in crude oil prices, so they aren't protected against a surge in refining margins. That's precisely why Delta bought its refinery in the first place.

Assuming jet fuel prices remain elevated for the month of September, many airlines could be forced to reduce their Q3 margin forecasts. As the only airline that owns a refinery, Delta is uniquely insulated from this threat.

Adam Levine-Weinberg owns shares of Delta Air Lines. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.