Warren Buffett is considered among the greatest investors of all time, having helped Berkshire Hathaway generate a compound annual gain of 19.8% from 1965 to 2022, smashing the S&P 500's total return of 9.9%. With Buffett's long track record, investors would be wise to read about his techniques, which he generously shares in his annual letter to shareholders. In recent years, Buffett has highlighted the importance of retained earnings.

Let's delve into the retained earnings formula, explore why Buffett favors this metric, and highlight two stocks in Berkshire's portfolio that excel at it.

What are retained earnings?

Retained earnings is a line item on the balance sheet demonstrating a company's accumulated profits over its lifetime. It is calculated by taking a company's net lifetime earnings and subtracting its dividends paid (and any net losses). Companies can use retained earnings to expand, make acquisitions, pay down debt, and repurchase their stock.

Buffett prefers to simplify the metric by focusing only on a company's annual earnings and dividends paid. That is because share repurchases can significantly distort the metric you see on the balance sheet. One of Buffett's favorite stocks, Apple, has surprisingly low lifetime retained earnings, at -$214 million. This is because of Apple's sheer number of share repurchases through the constructive retirement method, which assumes the shares will never be reissued, affecting retained earnings. Notably, Apple spent $77.5 billion on share repurchases in its fiscal year 2023 ended Sept. 30.

Two Warren Buffett stocks that excel in retained earnings

Beyond best-in-class Apple, two stocks in Berkshire's portfolio also excel in retained earnings: Bank of America (BAC -0.21%) and American Express (AXP -0.62%). In what is likely more than a mere coincidence, those two stocks are Berkshire's second- and third-largest holdings behind Apple, respectively.

First, Bank of America is the second-largest bank in the world by market capitalization, totaling about $265 billion. Over the trailing 12 months, Bank of America generated $30.5 billion in net income and paid roughly $9 billion in total dividends, resulting in retained earnings topping $21.5 billion during that time frame.

With its retained earnings, Bank of America has aggressively repurchased its stock -- retiring more than 18% of its shares outstanding over the past five years. Buffett recently wrote: "The math isn't complicated: When the share count goes down, your interest in our many businesses goes up. Every small bit helps if repurchases are made at value-accretive prices."

Nonetheless, despite Bank of America's share repurchases and a higher-than-average annual dividend yield of 2.9%, its stock has only generated a total return (price appreciation plus dividends) of 55% over the past five years, trailing the benchmark S&P 500's trailing return of 97%.

Bank stocks have underperformed recently either due to self-inflicted wounds like scandals around opening fake accounts or macroeconomic events largely out of a bank's control, like rising interest rates. Nonetheless, using the common valuation metric for bank stocks of price-to-book ratio, Bank of America currently trades at 1, meaning the market isn't placing a premium on its net assets like it does competitor JPMorgan Chase's price-to-book ratio of 1.6. Additionally, Bank of America's five-year price-to-book ratio average is 1.1, suggesting it might be slightly underpriced based on recent history.

Warren Buffett meets with shareholders.

Image source: The Motley Fool.

Next, let's look at the global financial services company American Express, a company Berkshire Hathaway first purchased in 1991, and which generated $8 billion in net income over the trailing 12 months. With an annual dividend yield of 1.3%, the company paid $1.7 billion in dividends to its shareholders. As a result, American Express produced roughly $6.3 billion in retained earnings.

Like Bank of America, American Express is aggressively buying back its stock with retained earnings, lowering its shares outstanding by 14% over the past five years. During that time, American Express outpaced its larger competitors by market cap, Mastercard and Visa, in stock buybacks (those companies repurchased 9% and 8%, respectively).

In addition to its share repurchases, American Express has acquired five fintech companies since 2019 -- all private companies for undisclosed prices. The strategy has proven helpful in fueling revenue growth as the company most recently set a sixth consecutive quarterly record, generating $15.4 billion for the third quarter of 2023.

Finally, American Express stock appears attractive when assessed against its competitors through the widely used valuation metric price-to-earnings (P/E) ratio. With a P/E multiple of about 17, American Express stands out as notably undervalued compared to Mastercard and Visa with P/E ratios of 36 and 31, respectively.

Are these two Warren Buffett stocks worth buying?

In 2020, Buffett wrote: "Retained earnings have propelled American business throughout our country's history. What worked for Carnegie and Rockefeller has, over the years, worked its magic for millions of shareholders as well."

These two stocks, plus Apple, make up roughly 65% of Berkshire's $370 billion stock portfolio, meaning they are likely some of Buffett's favorite stocks. Given Berkshire's past success, investors would be smart to follow the Oracle of Omaha's strategy and consider adding Bank of America and American Express to their portfolios.