I've covered Bank of America (BAC 1.35%) for several years now and have always liked the stock. But up until recently, I had never pulled the trigger on actually buying the stock, largely because I was a tad more aggressive in my long-term outlook, which still has a considerable amount of runway.

Warren Buffett's company Berkshire Hathaway (BRK.A 0.58%) (BRK.B 0.38%) has been going all in on Bank of America in recent years. Berkshire snapped up more than $2 billion of the stock in 12 consecutive days of trading in 2020 and now owns more than a billion shares of Bank of America, or close to 13% of outstanding shares. It's the second-largest position in Berkshire's nearly $319 billion equities portfolio.

I recently followed Berkshire's lead because right now I believe the bank has sufficient upside and is also prepared to weather any kind of severe recession that comes its way.

Strong revenue generation in any climate

A big reason I like Bank of America is that it really can generate strong revenue in a range of different economic scenarios. For instance, during the brunt of the pandemic when interest rates were low and loan activity was all but dead, Bank of America saw its investment bank step up and deliver enough revenue to offset some of the bleeding in its loan business. Now, with interest rates much higher and market volatility keeping investment banking activity muted, the loan and securities business is taking center stage.

Warren Buffett.

Image source: The Motley Fool.

Bank of America is one of the largest beneficiaries of rising interest rates in the industry. In the second quarter of this year, Bank of America saw investment banking fees fall by close to $1 billion from the second quarter of 2021, but still managed to grow revenue year over year.

That's because net interest income (NII), the profits banks make on loans and securities after covering the cost to fund those assets, is rising along with higher interest rates, which raises many of the bank's loan yields. Bank of America also has the best low-cost and sticky deposit base of any large bank, allowing its loan and security margins to widen during this time. Management only expects NII to accelerate in the third and fourth quarters of this year.

Bank of America is well prepared for a recession

Bank of America struggled during the Great Recession like many other banks due to subprime mortgage exposure. While the Great Recession does not seem like it was that long ago, a lot has changed over the last 12 years or so.

Banks have much more rigorous regulatory capital requirements and lending standards. They also go through stress testing every single year, in which the Federal Reserve puts the largest banks in the U.S. through a hypothetical severe economic scenario to see how their balance sheets would hold up.

In this year's scenario, the Fed had unemployment rising and peaking at 10% between the end of 2021 and the first quarter of 2024, during which time commercial real estate prices would fall 40% and stocks would drop 55%. The Fed projected that Bank of America would lose more than $52.5 billion in loan losses during this nine-quarter period and take an overall loss of nearly $44 billion. Despite these jaw-dropping numbers, Bank of America would maintain regulatory capital ratios well above what is required by the Fed.

While there is wide dispute over how things would play out if these stress test scenarios actually happened, many bank CEOs would argue that they don't think loan losses would get anywhere near these levels.

A great buy at this valuation

In hindsight, I wish I purchased Bank of America stock when it traded in the $20s like Buffett did. But with this recent pullback, investors can still buy Bank of America in the low $30s while it trades at roughly 145% of its tangible book value (its net worth) and at less than 10 times forward earnings. Yes, there could be a recession, but the bank is well prepared to navigate those waters and is currently experiencing the highest interest rate environment since before the Great Recession.