Thanks to a savvy investment made by Warren Buffett several years ago, Berkshire Hathaway (NYSE:BRK.A) (NYSE:BRK.B) recently became the largest shareholder in Bank of America (NYSE:BAC). The Buffett-led conglomerate owns 700 million shares of the banking giant. Let's look at the percentage of Bank of America that Buffett owns, and review how the Oracle of Omaha came to be Bank of America's biggest investor.

The short answer

As I mentioned, Berkshire Hathaway recently acquired 700 million shares in Bank of America. At the end of 2017's second quarter, there were a total of 9.88 billion shares outstanding, which makes Buffett's stake roughly 7% of the total.

Warren Buffett at Berkshire Hathaway's annual meeting.

Image Source: The Motley Fool.

A look behind Buffett's Bank of America investment

The story of how Berkshire Hathaway came to be Bank of America's largest shareholder is quite different than how the company invested in most of the rest of its stock portfolio. In other words, it didn't simply buy shares of the bank and build up a position.

In the wake of the financial crisis in 2011, Buffett decided to invest $5 billion of Berkshire's capital in Bank of America's preferred stock, which paid Berkshire a 6% annual dividend yield. As you may be thinking, generally speaking, a 6% return on investment isn't enough to get Buffett excited.

However, the deal had a sweetener. In addition to preferred stock, Buffett received warrants to purchase 700 million shares of Bank of America at any time before September 2021 at an exercise price of just $7.14 -- which was close to the actual share price of Bank of America stock at the time the deal was made.

The key point of the deal is that 700 million times the $7.14 exercise price is equal to $5 billion -- the value of the preferred stock Buffett purchased. This essentially meant that Buffett could exchange the preferred stock for 700 shares of common stock.

Well, Buffett decided to exercise his warrants shortly after the bank's 2017 capital plan was approved. At that point, Bank of America was trading for more than three times Buffett's exercise price.

Should you join Buffett and add Bank of America to your portfolio?

Despite the gains in Bank of America's stock price over the past few years that led to Buffett's big windfall, there's still reason to believe that Bank of America is an attractive long-term investment at the current price.

For starters, if Warren Buffett didn't think that Bank of America was undervalued, he likely wouldn't have exercised his warrants -- at least not yet. The main reason Buffett chose to exercise Berkshire's warrants more than four years before expiration was Bank of America's most recent dividend increase, as I mentioned, but dividend or not, Buffett is not in the business of owning stocks that he doesn't consider to be attractively valued.

Bank of America's management seems to agree. Along with the dividend increase, Bank of America announced that its board has approved the repurchase of up to $12 billion of its common stock during the one-year period from July 1, 2017 through June 30, 2018. This is more than twice the amount of the previous buyback authorization, and makes up more than 70% of the bank's planned return of capital to shareholders. In other words, Bank of America is still emphasizing buybacks, which is a good indication that management likes the value.

In full disclosure, Bank of America is one of my largest stock positions, but it's precisely because I feel that its price is attractive. Buffett and the bank's management team both seem to agree with me.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.