Bank of America (BAC -0.52%) reported second-quarter earnings this week, and it was a mixed bag. Revenue was up about 6% to $22.7 billion, beating analysts' forecasts, but earnings were down 32% to $6.2 billion.

The stock price has jumped about 10% since last Friday, July 15, buoyed by positive market reaction to the earnings report. But it is still down about 25% year to date, at $33 as of July 19. Let's take a closer look at the earnings numbers to see if the stock is a buy.

Interest income surges higher

Bank of America's solid earnings followed a lackluster earnings report from the nation's largest bank, JPMorgan Chase, the previous week. Coupled with decent earnings reports from Goldman Sachs on Monday and Citigroup last Friday, there has been some good momentum in the overall market the past few days.

But let's take a closer look at Bank of America's earnings to see what it means longer term. The overall revenue increase was buoyed by a 12% year-over-year jump in revenue in the consumer banking business (its largest business segment) to $9.1 billion, and a 7% revenue increase in its wealth and investment management business to $5.4 billion. These gains offset losses in its global banking and global markets businesses.

Some good signs for Bank of America, the nation's second-largest bank, are a 3% year-over-year increase in average loans and a 22% jump in net interest income to $12.4 billion. The loan growth signifies that despite inflation and economic concerns, loan activity hasn't slowed, and the jump in net interest income is the direct result of rising interest rates.

Also, the bank lowered its efficiency ratio by 5 basis points to 54%, which means that it is spending less to earn a dollar of revenue.

Looking at net income, it dropped year over year due to two primary factors. One, Bank of America set aside $523 million as a provision for credit losses, after a net reserve release of $1.6 billion a year ago. Part of that provision is related to exposure to Russian assets, but the huge release a year ago, post-pandemic, accounted for most of the difference in net income year over year.

The other factor was higher expenses, up about 2% to $15.3 billion. The jump was primarily related to fines from the Consumer Financial Protection Bureau and the Office of the Comptroller of the Currency over unemployment disbursements during the pandemic and funding set aside for a Securities and Exchange Commission probe related to documenting communications during the pandemic.

Is Bank of America stock a buy?

The increase in provisions for credit losses is concerning, especially with inflation rising and a possible recession looming. Net charge-offs increased 46% over the first quarter but are down 4% year over year to $571 million, with a ratio of 0.23%. Also, nonperforming loans (loans in default) were down 10% in the quarter and 15% year over year, with a ratio of 0.41%. This is obviously something to keep an eye on over the next few quarters.

The other metric to watch is loan activity. If the economy does fall into recession, will average loans contract or continue to grow? Rising interest rates should continue to boost net interest income, and as a bank that gets 40% of its revenue from consumer banking, it should help revenue, even if loan growth slows.

Bank of America is pretty cheap right now, with a price-to-earnings ratio of about 10, down from 17 a year ago, and a price-to-book ratio right around 1, down from 1.7 a year ago. It also has a pretty good dividend yield of 2.53% with a low 22% payout ratio.

For these reasons, Bank of America looks like a decent buy right now. Banks, in general, should perform well in this rising-rate period, as long as the economy does not go into a deep or long recession -- a big if, but one to consider.