Warren Buffett at Berkshire Hathaway's 2013 shareholder meeting. Image source: The Motley Fool.

When Warren Buffett advises investors to be "fearful when others are greedy and greedy when others are fearful," he means what he says. The multibillion dollar investment that Berkshire Hathaway (BRK.A 0.86%) (BRK.B 1.24%) made in Bank of America (BAC 3.20%) in 2011 serves as a case in point.

A steal of a deal

The terms of the deal were certainly advantageous to Berkshire. In exchange for $5 billion, the Buffett-led conglomerate got $5 billion worth of preferred stock as well as warrants to purchase 700 million shares of Bank of America's common stock at any time until Sept. 2021 at an exercise price of $7.14 per share.

Given the current value of Bank of America's common stock, this means that Berkshire's investment in Bank of America has more than tripled in value. And if you include the roughly $1.5 billion worth of dividends that have already been paid on the preferred stock, Berkshire's $5 billion investment is now worth $17.4 billion.

Data source: Bank of America, Yahoo! Finance. Chart by author.

What fueled the gain?

The value of Berkshire's investment in Bank of America has been bolstered by a number of different factors. In the first case, the valuation of Bank of America's stock has risen considerably since Buffett's well-timed investment in August 2011.

At the time, Bank of America's shares traded for a 47% discount to its tangible book value. Fast forward to today, and they trade for a 33% premium to the bank's tangible book value.

And it's not like Bank of America's tangible book value has stayed the same over the past five years. It went from $13.22 a share in the third quarter of 2011 up to $17.14 today. That equates to a 30% increase.

Both trends have been fueled by a steadily improving outlook for the nation's second biggest bank by assets. It's cut $15 billion worth of annual expenses over the past five years. And after spending $191 billion on financial crisis-related expenses, it finally put the last of its massive liabilities behind it last year.

Bank of America is now once again focused on growing its revenue, as opposed to trimming operating expenses and seeking to contain any residual damage from the 2008 crisis.

The Trump bump

More recently, moreover, all bank stocks have gotten a potent shot in the arm thanks to the outcome of this year's presidential election. The incoming administration's promise to reduce taxes, increase infrastructure spending, and deregulate the banking industry has dramatically improved investor sentiment toward bank stocks.

And the Federal Reserve has played a part too, by raising interest rates this month for only the second time since the financial crisis. If the central bank follows through on its projected interest rate strategy, Bank of America could earn $5.3 billion more a year in net interest income starting sometime in 2017.

It's for these reasons that Bank of America's shares have gained 37% since the beginning of November alone.

In short, while no one should be surprised anymore at Buffett's prescience, it's still incredible to see a deal like this work out so incredibly well for the 86-year-old Oracle of Omaha.