The stock market has been rather strong in 2023 after a weak 2022. Through Dec. 12, the S&P 500 benchmark index had risen by 21% for the year and is hovering at a new 52-week high.

Not all areas of the stock market have done quite so well. The financial sector is one that has underperformed the market, with a 7% gain so far this year, 14 percentage points below that of the S&P. There are some good reasons: Rising rates have made it tougher for brick-and-mortar banks to compete with online rivals for deposits; there are still widespread fears of a recession and rising loan defaults in 2024; and of course, many investors are still hesitant to pull the trigger on bank stocks after several high-profile bank failures earlier this year.

While these are some legitimate concerns for sure, the fact is that patient, long-term investors can find some excellent bargains in the banking industry right now. Here are two in particular that could be worth a closer look.

Buffett's favorite bank stock

Bank of America (BAC -0.21%) is an especially interesting case right now, with shares down by 7% in 2023 despite strong results from the business.

In the third quarter, Bank of America posted 3% year-over-year revenue growth and 11% higher earnings per share thanks to improved efficiency. And while some of its peers saw deposits decline due to the higher rates offered by online counterparts, Bank of America's $1.9 trillion deposit base slightly increased sequentially.

One of the biggest reasons investors are pessimistic about bank stocks is the fear that rising inflation, the end of pandemic-era loan forbearance, and other economic factors would lead to rising loan losses, but the data shows there is little reason to be alarmed. While Bank of America's net charge-off ratio has indeed ticked upward, it appears to be a normalization rather than a spike. In fact, the bank's net charge-offs remain below where they were in late 2019 before the pandemic and in a strong economy.

As of this writing, Bank of America trades for 94% of its book value (for context, the bank was trading for 160% of book in early 2022). The stock has a well-covered dividend yield of 3.1%, and management has done a great job of using excess capital to reduce the share count by more than 18% over the past five years. With excellent asset quality and a great cost of capital, it's not a surprise that Warren Buffett-led Berkshire Hathaway (NYSE: BRK.A)(NYSE: BRK.B) recently dumped several other bank stocks but maintained Bank of America as one of its largest investments.

A regional bank -- sort of

Truist Financial (TFC 0.53%) is technically a regional bank in the sense that it only has branches in certain parts of the U.S., and its stock has been treated as such by investors who still have lingering fears from the regional banking turbulence earlier this year. Truist's stock is down by 20% year to date and trades for a 17% discount to its book value.

However, Truist isn't just a regional bank. For one thing, it's larger than many national banks and is one of the largest banks of any kind in the United States. With $543 billion in total assets, Truist is more than double the threshold to be considered a systemically important financial institution, or SIFI, which means that it has greater regulatory scrutiny than most banks.

Truist's recent results have been strong, and the bank is in the middle of a $750 million cost-saving initiative that should sustainably boost its profitability. And while there are fears about loan losses escalating throughout the industry, Truist's nonperforming loan ratio actually declined from Q2 levels.

Truist has a lot to like from a long-term perspective. In the meantime, it pays a 6.1% dividend yield, making it an excellent buy-and-hold candidate at these levels.

The bottom line

Both Bank of America and Truist are rock-solid financial institutions trading for a big discount due to economic and industry headwinds. And while there's no way to know whether rates will start to normalize soon or if the economy will have a "soft landing," signs are definitely pointing in that direction. Plus, from a long-term perspective, these banks are earning tons of money, have excellent leadership, and could produce market-beating returns for years to come.