Berkshire Hathaway (BRK.A -0.05%) (BRK.B 0.28%) is considered by many to be a reliable stock for long-term investors. It's outperformed the S&P 500 ever since a young Warren Buffett took over the company in 1965, and its evolution from an aging textile maker to a diversified conglomerate churned out millionaire-making gains.

But over the past 12 months, Berkshire Hathaway's stock is only up 7.4%, as the S&P 500 rallied 16%. Below, I'll examine why it underperformed the market -- and why it's still worth accumulating before its next earnings report in November.

Berkshire Hathaway CEO Warren Buffett.

Berkshire Hathaway CEO Warren Buffett. Image source: The Motley Fool.

Why did Berkshire Hathaway underperform the market?

The heaviest weight on Berkshire's stock was Buffett's announcement in early May that he would retire by the end of the year from his role as CEO. He will be succeeded by Greg Abel, the chairman and CEO of Berkshire Energy. Abel has been with Berkshire since 1999 but isn't a seasoned stock picker like Buffett or his longtime partner, the late Charlie Munger. Buffett will keep his title as board chairman.

Berkshire's stock portfolio is worth $295 billion, or 29% of its market cap of $1.03 trillion. If Abel and his team mismanage that massive portfolio -- which includes big stakes in Apple, American Express, Bank of America, and Coca-Cola -- it could erode the company's long-term earnings growth. Berkshire's focus on value stocks further capped its gains this year as many investors rotated toward growth plays.

That's not all. Ajit Jain, who served as Berkshire's insurance chief for nearly four decades, sold more than half of his shares in 2024. Berkshire then paused its buybacks, sold a lot of its top stocks, and boosted its cash and equivalents to record highs with its massive purchases of short-term Treasuries. All of those conservative moves suggested both Berkshire's stock and the broader market were getting overvalued.

Why is Berkshire Hathaway still a compelling investment?

Those challenges are clearly preventing the bulls from rushing back to Berkshire, but I think its stock still looks reasonably valued. At its current market cap, Berkshire trades at 21 times its operating earnings (which exclude its investment-related gains and losses) from 2024.

Flipping the calendar back to the end of 2019, Berkshire's stock was still trading at 23 times operating earnings for the year. If you didn't invest in Berkshire back then because you thought it looked a bit too pricey, you missed out on a gain of more than 110%.

From 2019 to 2024, Berkshire's operating earnings grew at a compound annual growth rate (CAGR) of 15% -- even as the pandemic, inflation, high interest rates, trade wars, geopolitical conflicts, and other macro headwinds rattled the global markets. It achieved that stable growth because its core business generates a lot of its profits from its insurance subsidiaries -- which are better insulated from economic downturns than other sectors. As interest rates decline and the macro environment stabilizes, its other subsidiaries -- especially those in the railroad, energy, and consumer staples sectors -- should shine again and complement the growth of its insurance businesses.

As for Buffett's retirement and its potential impact on Berkshire's portfolio, I don't think Abel will abruptly shake up those stocks. Instead, he'll probably stick with Buffett's value-oriented stock-picking strategies instead of chasing riskier and higher-growth plays. Its core business should keep generating fresh cash to gradually expand that portfolio.

Berkshire Hathaway might experience a few hiccups as Buffett finally retires, but I believe he built a company that will keep growing for decades to come. It might not stir up as much excitement as it did in the past, but it's still one of the best stocks to buy right now.