FORTUNE — Warren Buffett is turning one of his biggest blunders into a deal for Berkshire Hathaway.
On Monday, Berkshire (BRKA) announced it was acquiring a specialty chemical division of oil refiner Phillips 66 (PSX). To pay for the deal, Berkshire is going to use Phillips 66 shares it holds, handing them back to the company in exchange for the deal.
Berkshire got its Philips 66 shares from a 2008 investment in ConocoPhillips (COP). Buffett bought the stock when oil prices were near their peak. It quickly became apparent it was a bad call. In Berkshire’s annual report, Buffett called the investment a “major mistake,” taking full blame.
According to an analysis on Seeking Alpha, Berkshire paid roughly $82 a share for the nearly 85 million shares of Conoco it bought, or nearly $7 billion. The stock currently trades for $70. So if Berkshire still held all of its shares, that holding would be worth $5.9 billion, meaning Buffett would have lost about $1.1 billion on the investment.
Berkshire didn’t hold on to the stock, though. It sold along the way and now only owns around 15 million shares. The stock has mostly gone up from hitting a low of $32 in early 2009. So Buffett probably lost more than $1 billion on the investment, mistiming the stock on the way down and the way back up. That’s why Conoco is often seen as one of Buffett’s largest blunders.
But one of the things that gets left out of that analysis is the Phillips 66 stock that Berkshire got from the spin-off. According to its latest filing, before this acquisition, Berkshire owned nearly $1.6 billion in Phillips stock. Berkshire’s 2012 annual report puts a cost basis on that holding of $660 million. But Berkshire bought more Phillips stock after the spin-off, so not all of it came from its Conoco investment.
Now, for a portion of those shares (Berkshire and Phillips didn’t say how much), Berkshire is getting a division of Phillips that makes a chemical used in transporting oil. It’s similar to something made by Lubrizol, which is also owned by Berkshire. So, basically, Berkshire is taking out the competition, though it will continue to run the new unit separately. And doing the deal with Phillips’ own shares, rather than cash or Berkshire’s stock, will probably save Berkshire money on taxes it would have paid on any gains it had in Phillips stock.
Still, the transaction shows once again how Buffett is able to capitalize his investments in ways that Average Joes can’t, getting as much value as he can out of every deal, even the bad ones.