Image source: Getty Images.

Warren Buffett, chairman and CEO of Berkshire Hathaway (BRK.A 0.99%) (BRK.B 0.91%) and arguably the greatest investor of all time, owns substantial stakes in both Bank of America (BAC 2.06%) and Wells Fargo (WFC 1.24%). The Oracle of Omaha spoke glowingly of Bank of America in his most recent letter to shareholders and has made no secret of his affinity for Wells Fargo over the years.

If Buffett loves both banks, but you can only have just one, which do you choose? In my view, the right stock to buy for a long-term investor is Wells Fargo, and I think Buffett would agree. Here's why.

What has Buffett been doing with Wells Fargo and Bank of America lately?

Buffett's position in B of A began in 2011, when he negotiated a $5 billion investment in preferred stock, plus the option to buy 700 million common shares for another $5 billion anytime between now and 2021 -- that's $7.14 per share. At the time of this writing, B of A trades for $14.26, almost exactly double Buffett's strike price. His preferred shares pay a 6% dividend.

He first began building his position in Wells Fargo in 1990. In the years since then, he's gradually increased his stake to over 10% of the company's outstanding shares today. His purchases accelerated in the mid-2000s, with significant new share purchases every year from 2004 to 2012.

In both cases, Buffett first invested in each bank during tumultuous times when the market value for bank stocks was depressed. What's different is how Buffett has continued to make follow-on investments in Wells Fargo in recent years, while he's been content to simply sit on his Bank of America options without increasing his stake. To me, that's telling.

A philosophy for bank stock investing

It is no secret how Berkshire Hathaway makes investments in bank stocks. In Buffett's 1990 letter to shareholders, he explained to Berkshire shareholders that "we have no interest in purchasing shares of a poorly managed bank at a 'cheap' price. Instead, our only interest is in buying into well-managed banks at fair prices."

The banking business model requires very high leverage ratios, meaning that even small losses relative to its assets can cause a bank to fail. The best banks -- those worth an investment -- are therefore those with the right balance of risk management, profitability, and growth. Managing that three-legged stool is no simple task, a fact Buffett recognizes in his requirement for "well-managed banks" only.

And of course, as Buffett is the consummate value investor, the stock must also be priced attractively.

Comparing Wells Fargo and Bank of America today, it's clear to me that Wells is the better managed bank. Bank of America CEO Brian Moynihan may be able to change that narrative in the future, but for now, the numbers are clearly in favor of Wells Fargo.

Wells Fargo is, by the numbers, a better bank than Bank of America

On a trailing-12-month basis, Wells Fargo's return on equity is 13.02%. Bank of America's is less than half that, at 6.19%. Despite having 19.9% more assets than Wells Fargo at year-end 2015, Bank of America's annual net income was $7 billion less. Since Dec. 31, 2006, Wells Fargo's total assets have grown 271%. Bank of America's have grown just 47%. Over that same period, Wells Fargo's annual net income jumped 172%, in contrast to B of A's 24.8% decline. Even Wells Fargo's dividend yield is more than double Bank of America's, at 3.19% to 1.46%, respectively.

BAC Net Income (Annual) Chart

BAC Net Income (Annual) data by YCharts

Investors today shouldn't forget how Buffett negotiated such a great deal in Bank of America in the first place. When the company was on the ropes following the financial crisis, Buffett's investment diluted existing shareholders, but it was necessary to boost confidence in the stock and to resupply B of A's capital coffers. Thanks largely to dilution, Bank of America's stock today is 74% below its all-time highs from 2006.

The temptation to buy Bank of America over Wells Fargo

No matter how you slice it, Wells Fargo's operating performance is better than Bank of America's. The market recognizes this, pricing Wells Fargo at a premium price and Bank of America at a discount. Using the price-to-book value ratio, Wells trades at 1.39 times its book value, compared with Bank of America's 0.61.

Generally, a price-to-book value greater than 2 indicates that a bank stock is expensive, and less than 1 indicates the stock is cheap.

The temptation to buy Bank of America's stock based on that cheap price alone is understandable. However, remember what Buffett said in 1990. Buffett has "no interest in purchasing shares of a poorly managed bank at a 'cheap' price." At 0.61 times book value, Bank of America is, if nothing else, cheap.

Still to be determined is whether the company's current management regime can create a high-performing culture to match Wells Fargo's.

Given that, I think that Wells Fargo remains the better buy today, and based on his buying habits in recent years, it seems Buffett may agree as well.