The past several years haven't been great for Berkshire Hathaway (NYSE:BRK.A)(NYSE:BRK.B) investors. Berkshire underperformed the SPDR S&P 500 ETF Trust (NYSEMKT:SPY) over the past one, three, five, and even 10-year periods. One reason for the underperformance is Buffett's penchant for investing in banks, which make up a massive portion of the Berkshire stock portfolio and have been crushed by the economic impact of the coronavirus pandemic.

Included in that collection of laggards is Bank of America (NYSE:BAC), which has performed even worse than Berkshire. But let's look past the recent stock performance. Bank of America's scale is an enormous benefit, while Berkshire remains one of the strongest companies in the world, generating enormous cash flows in nearly any economic environment. Moreover, both trade at very attractive valuations that could lead them to deliver solid returns for investors going forward. 

Hand drawing scales with price on one side and value on the other.

Image source: Getty Images.

In other words, they're both solid buys right now. So which is the better buy? Let's take a closer look. 

Choosing from Buffett's two biggest recent investments 

Banks face a tough road ahead. Interest rates are at all-time lows, and the economic overhang of the coronavirus pandemic could affect business and consumer lending for years. That's likely why Berkshire trimmed its stakes in JPMorgan Chase (NYSE:JPM) and Wells Fargo (NYSE:WFC) and sold all its shares of Goldman Sachs (NYSE:GS) in the second quarter. 

Buffett has taken the opposite approach with Bank of America. According to a regulatory filing, Berkshire has spent $2.1 billion on Bank of America stock since July, and now owns almost 12% of the bank. This makes Bank of America Berkshire's second-largest holding, worth almost $25 billion. 

But the stock that Berkshire has bought more of so far this year is...Berkshire Hathaway. In the second quarter, Buffett repurchased $5.1 billion in Berkshire stock. That's more than it repurchased in all of 2019. 

The case for Bank of America

Over the past decade, Wells Fargo and Bank of America seemingly traded places in Buffett's mind. While Wells has struggled with a mess of its own making with the fake accounts scandal, Bank of America has moved far beyond its troubles coming out of the 2008 financial crisis. Their financial results show how the two have diverged recently:

BAC Net Income (Quarterly) Chart

BAC Net Income (Quarterly) data by YCharts

The second quarter of 2020 was brutal for banks, including Bank of America. Return on assets and return on equity below 1% and 10% is disappointing, and chances are the third-quarter results will also be worse than last year. But as the chart shows, Bank of America is holding up much better than Wells. 

Wells' big losses led the bank to slash its formerly industry-leading dividend, while Bank of America's $0.18 quarterly dividend looks plenty safe. 

Bank of America has access to some of the lowest-cost capital in banking, paying a minuscule 0.13% in yield on interest-bearing deposits that it lends out at much higher rates. That will help its earnings hold up better than many other banks and even provide outsize earnings growth as rates recover. 

Lastly, Bank of America is dirt cheap. It's been five years since its shares traded for a book value this attractive. Its earnings valuation doesn't look quite as cheap, but that's partly due to the decline in profits so far this year: 

BAC PE Ratio Chart

BAC PE Ratio data by YCharts

I think it's better to weigh Bank of America at these prices based on the earnings it should be able to generate once interest rates rise again on a full post-pandemic economic recovery. 

Berkshire is worth buying, too

The S&P 500 (SNPINDEX:^GSPC) index has come roaring back from the depths of the coronavirus crash. The S&P fell 34% in barely over a month earlier this year, the fastest fall into a bear market in history. The 126 trading days it took to recover those losses was also a record. 

But Berkshire, like Bank of America, has lagged the market, and shares are still down almost 10% from the high. While tech stocks have lifted the index, Berkshire's insurance subsidiaries, bets on airlines and aircraft sales, and heavy investments in banks and finance companies have kept investors away. Were it not for the massively successful investment in Apple, the Berkshire stock portfolio's returns might have been even worse.

Looking beyond the Berkshire portfolio, investors shouldn't sleep on its operating businesses. Berkshire is one of the largest utilities in the country. It also owns one of the biggest railways, and its insurance subsidiaries consistently deliver underwriting profits. The recession-resistant nature of much of its core operations could prove immensely valuable so long as the coronavirus pandemic weighs on the economy. Berkshire is a cash-cow business. 

BRK.B Cash from Operations (TTM) Chart

BRK.B Cash from Operations (TTM) data by YCharts

Combine the strengths of its core business with the underperformance of its portfolio and the eventual turn in the banking cycle, and Berkshire could be a market-beater in the years ahead. That's particularly true when you consider how much its valuation has fallen over the past several years:

BRK.B Price to Book Value Chart

BRK.B Price to Book Value data by YCharts

Better buy: Bank of America

First, let me say that I think Berkshire is also a buy at these prices. It's a world-class business, let by one of the best investors and managers of all time, surrounded by an incredible leadership team. Between its cash-cow operating businesses, the recovery of its equity holdings, and future investments of the $140-plus billion in cash on the books, Berkshire will almost certainly be a profitable investment over the next five-plus years. 

But I think Bank of America's prospects are even better. Not only is it plenty strong enough to survive the downturn, but all of the catalysts that would be good for Berkshire would also likely be even better for Bank of America. In addition, while Berkshire stock is a solid value, Bank of America is dirt cheap, trading for about 90% of book value. That's a bargain for such a high-quality business. It may take a few years for the banking cycle to turn, but in the meantime, enjoy an above-average dividend that's far higher than you'll earn on your deposits. 

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.