One of the key topics in the markets and the economy in 2023 has been the regional banking fiasco. Rapidly rising interest rates left many long-dated loans -- which some banks held on their balance sheets -- at a huge paper loss. That prompted customers to panic and move their deposits quickly in case these financial institutions failed.

This unfavorable situation, one that has really shined a spotlight on the banking industry, might discourage investors from even considering putting any money to work in the sector. 

But it's a mistake to group together all bank stocks in the same category. In fact, some of them, like Ally Financial (ALLY 0.41%), are better than others. Here's why this online bank is a business that investors should think about buying right now. 

A growing deposit base 

As of March 31, Ally's retail deposits totaled $138.5 billion, up $813 million from just three months prior. That's a really encouraging sign; it's a vote of confidence from customers that they trust Ally as a safe place to park their hard-earned capital. Moreover, the leadership team says that 91% of those retail deposits are FDIC insured. 

Banks are essentially facilitators, taking in capital from multiple sources and then lending it out at higher rates, making money from this spread. A bank that can grow its deposits, especially at a time of heightened turmoil in the industry, is in a beneficial position because deposits are usually the lowest-cost source of funding. 

Diving deeper into Ally's first-quarter numbers, the bank posted a net interest margin (NIM) of 3.51%, down from 3.93% in the year-earlier period. That might be cause for concern, but investors should understand that the Federal Reserve's hiking interest rates at the fastest pace in history has impacted banks of all sizes as it relates to this metric. 

On the asset side, about 58% of Ally's loans and leases (as of March 31) were retail auto loans. The advantage this gives the company is that the average term for a car loan is roughly three to seven years, so as more of these loans are repaid, Ally will be able to lend at higher rates. And this should help expand the NIM in the future. 

Buffett's endorsement 

Having Warren Buffett as a fellow shareholder certainly helps retail investors who are on the fence about buying Ally stock. The Oracle of Omaha definitely knows a thing or two about putting capital to work in the banking industry. Bank of America is Berkshire Hathaway's second largest position. 

But with a market value of $823 million, good for 9.6% of the outstanding shares, Buffett's conglomerate has a sizable stake in Ally. He knows banks well, so the fact that he owns so much stock in Ally is a wonderful endorsement about the quality of this business. 

Ally does have some attractive characteristics. Most notable is the fact that it doesn't have a physical network of bank branches, which helps lower corporate overhead expenses, resulting in better rates for depositors and borrowers.

And Buffett is known for having an extremely long time horizon when picking stocks. Banking in particular can be viewed as a "forever" type of industry given how essential it is to individuals, companies, and the economy overall. Maybe average investors should think about Ally's stock in the same way. 

Ally's valuation 

Over the past five years, Ally shares are only up 8%, obviously not anything to write home about. This huge underperformance compared to the S&P 500 has resulted in the stock trading at a price-to-earnings ratio of just seven. Besides this cheap valuation, Buffett probably also loves the 4.2% dividend yield, as well as the shrinking outstanding share count. 

Ally is performing relatively well in what has been a tumultuous time for the entire banking sector. Investors looking to allocate capital to the financial services industry should consider following Buffett and buy shares.