Warren Buffett is quite possibly the most famous investor of all time. The Oracle of Omaha built a fortune for himself and Berkshire Hathaway (NYSE:BRK-B) (NYSE:BRK-A) shareholders by investing in great businesses at attractive prices. His philosophy over the past many decades of investing has been to buy companies with what he calls wide economic moats. In other words, he looks for companies whose industry-leadership position is very difficult for competitors to encroach upon.

With that in mind, it's no wonder that Buffett owns shares of consumer-staples giant Procter & Gamble (NYSE:PG). Berkshire recently made headlines by announcing it will buy one of P&G's brands, Duracell, for a net purchase price of about $3 billion. While it wold be easy to instinctively chalk this one up as another win for the Oracle, it's important to remember that there are two sides to every deal. Here's a look at some  motivation for both sides, and why, from a purely business-related standpoint, it's P&G that may have gotten the better of the deal.

The logistics of the deal
As part of the deal, Berkshire will trade the P&G stock it owns in exchange for Duracell and about $1.8 billion of cash. It seems that for Buffett, the rationale for the deal stems largely from a tax perspective. Buffett originally owned shares of Gillette, but in 2005, P&G bought out Gillette in a stock-for-stock transaction, and Buffett earned a huge return on his shares. In the many years since, Buffett's P&G stake continued to increase in value. According to Berkshire's most recent annual letter, Berkshire's stake in P&G has a $336 million cost basis. As of November, that investment is now worth $4.7 billion.

If Berkshire were to sell the investment outright, it would be subject to some stiff capital gains taxes. By pursuing this deal, essentially trading the P&G stock for Duracell plus cash, Berkshire is able to avoid these taxes, which would conceivably be well north of $1 billion. That alone is reason enough for Buffett to do the deal.

Back to business
From a business perspective, P&G got the better deal. For a while now, P&G management has stated its desire to trim its portfolio down by selling off businesses that are not deemed critical to the company's future. Batteries definitely qualify as a business that can be shed under this criteria, as the battery industry has seen sales slow recently. According to analysts from S&P Capital IQ, Duracell sales have declined by 2% to 4% for the past few years. In addition, sales are falling for Duracell's major rival, Energizer Holdings(NYSE:ENR). Sales of Energizer's alkaline batteries dropped 6% in the fiscal year ended Nov. 12. As battery technology advances, rechargeable batteries and devices that don't require traditional batteries are causing headaches for major players Duracell and Energizer.

Meanwhile, thanks to the deal with Buffett, P&G gets to unload an under-performing business so that it can focus on its higher-performance brands. In all, P&G management has stated its desire to sell off about half of its global brands to cut its portfolio to around 70 to 80 brands. Plus, selling Duracell to its existing shareholder Berkshire was in all likelihood a much easier and quicker process than pursuing a different avenue, such as a spinoff.

Purchase price bolsters Buffett's decision
One factor working in Buffett's favor, in addition to the significant tax benefit, is the purchase price of the deal. P&G will receive a price of approximately 7 times earnings before interest, taxes, depreciation, and amortization, or EBITDA. This is a cheap multiple; considering that Energizer Holdings trades for an EBITDA multiple of about 10.

Still, a low multiple is entirely appropriate for a declining business. Energizer isn't quite an apples-to-apples comparison, because the company as a whole is still growing thanks to its other businesses, such as personal care. Were P&G to hold off on the deal, a continued sales decline for Duracell would probably mean an even lower multiple in the future. . The benefits to Berkshire of tax savings and a cheap price tag are offset by an underperforming business.

There really don't seem to be any negatives for P&G in this deal. It will shed a declining business it doesn't want to be in, and it can now focus on its remaining brands. In the end, both sides appear to win from the deal, with P&G being the bigger winner.

Bob Ciura has no position in any stocks mentioned. The Motley Fool recommends Berkshire Hathaway and Procter & Gamble. The Motley Fool owns shares of Berkshire Hathaway. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.