At the low point of Bank of America's (BAC -0.13%) post-financial crisis struggles, Warren Buffett became its biggest advocate by investing $5 billion of Berkshire Hathaway's (BRK.A -0.28%) (BRK.B -0.68%) money into the nation's second biggest bank by assets.

In exchange, Berkshire Hathaway received $5 billion worth of preferred stock yielding 6% a year plus warrants to purchase 700 million shares of Bank of America common stock at an exercise price of $7.14 per share.

It was a shrewd move by Buffett. In addition to the $300 million in annual dividends that Berkshire Hathaway has collected over the past four years, its sizable stake in Bank of America's common stock has ballooned in value.

On the day the investment was announced, shares of the $2.2 trillion bank closed at $8.17 a share. Today, following a recent post-earnings surge and retreat, they're at $17.53.

When you include the $5 billion in preferred stock, Berkshire Hathaway's investment in Bank of America is worth a total of $12.2 billion. That equates to a 144% gain in four years -- 168% if you also account for the roughly $1.2 billion in cumulative dividend payments on its preferred stock.

For other Bank of America shareholders, the outcome isn't as rosy. This is because Berkshire's common stock warrants, once exercised, will dilute shareholders.

Bank of America's book value per share at the end of the second quarter was $21.91. If you adjust that to reflect Berkshire's 700 million shares of common stock, the figure falls by roughly 6% to $20.53.

Fortunately, there is an alternative to this outcome; one that was used by Goldman Sachs (GS -0.23%) to reduce the dilution from a similar deal between it and Berkshire Hathaway.

In 2008, Buffett's company invested $5 billion in Goldman Sachs in exchange for $5 billion in preferred stock and warrants to buy $5 billion worth of common stock at a price of $115 per share -- Bank of America's deal with the Oracle of Omaha closely tracked these terms.

Five years later, with Goldman's stock trading for more than $160 per share, the premium on Berkshire's warrants was worth roughly $2 billion. But instead of buying 43.5 million shares at the $115 exercise price, Berkshire received 13.1 million shares free of charge.

The net result for Berkshire was the same. Either it paid $5 billion to purchase 43.5 million shares, giving it a $2 billion gain, or it took $2 billion worth of common stock in lieu of the gain.

From a dilution standpoint, this is a better outcome, as it reduces the number of new shares that would have to be issued. But from a capital standpoint, it isn't as ideal. Had Berkshire exercised its warrants, Goldman's capital base would have expanded by $5 billion. Instead, it stayed the same.

Whether Bank of America will ultimately take a similar route remains to be seen -- my guess is that it will. But either way, I don't think anyone would argue that having Buffett as a stakeholder isn't a coup for the rapidly recovering megabank.