As investors look toward 2023, there is renewed optimism for a more positive market and economic environment. However, the reality is, the conditions that caused the bear market of 2022 have not really changed a whole lot and could be with us for some time.

But some stocks, like Bank of America Corp. (BAC 0.28%), actually finished the year on a high note, relatively speaking. Bank of America gained 6.39% in the second half of 2022, according to S&P Global Market Intelligence. Can it continue that momentum in 2023? Is the worst over? 

Outperformed the average bank

Bank of America, the second largest U.S. bank, actually outperformed the average bank stock in the second half of 2022. The KBW Nasdaq Bank Index, which tracks the performance of the largest banks, was essentially flat in the second half of the year. For the entire year of 2022, the index was down 21.4%, while Bank of America fell slightly more, 23.8% in calendar year 2022.

So, what drove the outperformance in the second half of the year? Rising interest rates allowed the bank to generate high levels of net-interest income on its loans, which offset losses in other portions of its business, particularly investment banking and asset management. In the most recent quarter, the third quarter, interest income accounted for $13.8 billion in revenue, up 24% year over year. That represented more than half of the $24.5 billion in total revenue.

Two other factors were major contributors to Bank of America's outperformance in the second half of last year. One, loan activity remained robust, as average loan balances were up 11% year over year to $1.0 trillion in Q3. The second key metric is credit quality. Bank of America was able to lower its net charge-off ratio in Q3 from the previous quarter and keep it on par with Q3 2021. That, in turn, has kept provision for credit-loss builds down, compared to others.

Bank of America has benefited from a decade-plus long commitment to diversifying its loan mix. In 2009, 67% of its loans were consumer loans. In 2022, 56% of loans are commercial loans, with 44% consumer loans. This has helped lower the bank's credit risk.

What's in store for 2023?

With interest rates expected to continue to rise and the possibility of an economic recession, 2023 could be another challenging year. But Bank of America is in a good position to continue its positive momentum given high interest rates, its anticipated loan growth, and its good credit quality.

One other advantage Bank of America has had is low deposit betas -- the amount it has to increase its interest paid on deposits as interest rates decrease. As of the end of Q3, Bank of America had a lower deposit cost and raised its deposit rate the least of any other major bank except for Wells Fargo.

This means that the less paid out in deposit interest, the more the bank can maximize net-interest income. Bank of America is able to do this because it has managed to increase deposits with a stable, growing customer base and a broad suite of products and services.

Overall, the worst should be over for Bank of America. This year remains fraught with uncertainty, but ultimately, the stock should have a better year in 2023.