The banking sector has been one of the market's top performers over the past year or so, and there could be more good times ahead. If interest rates continue to rise, tax reform passes, and banking regulations get loosened, there could be more upside for bank stocks in the coming years.

Two of the biggest players in the industry are Wells Fargo (NYSE:WFC) and Bank of America (NYSE:BAC), and they are two very different ways to play the sector. For one thing, Wells Fargo is a pure-play commercial bank, while Bank of America has a much more diverse business. And while Bank of America has been one of the sector's biggest winners, Wells Fargo has underperformed.

Is Wells Fargo a bargain, or is it still dangerous? Has Bank of America gotten too expensive? Here's a look at these two bank stocks, and which could be the better buy now.

Bank teller greeting a customer.

Image source: Getty Images.

Bank of America has improved tremendously

Bank of America has been one of the post-financial-crisis success stories. The bank, led by CEO Brian Moynihan, has successfully transformed itself into an institution of high asset quality and smart risk management, and is starting to produce consistent profits.

In addition, Bank of America has emerged as a leader in mobile and online banking technologies and is using its digital success to reduce its physical footprint and run more efficiently.

Over the past year alone, Bank of America's net income rose by 13%, deposits and loans grew by 4% and 6%, respectively, and thanks to a 3% drop in noninterest expense, the bank's efficiency ratio improved significantly.

Wells Fargo's scandals have held the bank back

There's a good chance you're familiar with Wells Fargo's infamous fake-accounts scandal, in which thousands of employees improperly opened as many as 3.5 million accounts for customers. In addition, the bank has been the subject of a few smaller, but still troubling, scandals as well. To name one example, it was revealed in July 2017 that Wells Fargo wrongly charged more than 800,000 auto loan customers for insurance they didn't need.

In the bank's recent third-quarter earnings report, the lingering effects of the scandal are apparent. The bank's generally strong profitability has eroded, and returns on equity and assets failed to meet the industry benchmarks of 10% and 1%, respectively, for the first time in a while. Furthermore, while most other banks saw revenue increases over the past year, Wells Fargo was an outlier with a 2% revenue drop.

As a result of the scandals plaguing the bank, Wells Fargo has dramatically underperformed the rest of the banking sector, and Bank of America in particular. Since the beginning of September 2016, before news of the fake-accounts scandal broke, Bank of America has risen by 76%, while Wells Fargo is up by a comparably dismal 12%.

WFC Chart

WFC data by YCharts

Valuation

My preferred metric for evaluating the valuations of bank stocks is the price-to-tangible book value (P/TBV) ratio. However, this doesn't tell the entire story. The P/TBV ratio should be considered in combination with other factors, such as how profitable the bank is, to determine whether the stock is cheap or expensive.

With that in mind, here are some of the key metrics for both banks.

Bank

Recent Stock Price

Tangible Book Value

P/TBV

Return on Assets (ROA)

Return on Equity (ROE)

Bank of America

$27.64

$17.23

1.60

0.98%

8.1%

Wells Fargo

$55.57

$28.21

1.97

0.94%

9.1%

Data source: Stock prices from TD Ameritrade as of 11/28/17. All other metrics calculated using company financials as of 9/30/17.

Which is the better buy now?

The takeaway from the chart in the previous section is that even though Bank of America's stock has dramatically outperformed Wells Fargo over the past year and a half or so, Wells Fargo still trades for a premium valuation. That used to make sense -- after all, Wells Fargo had been the most profitable of the big four banks consistently for some time.

WFC Return on Equity (TTM) Chart

WFC Return on Equity (TTM) data by YCharts

That's no longer the case as of the latest quarter, and the two banks' recent profitability metrics are quite comparable. Bank of America actually produced a better return on assets than Wells Fargo, which would have been unthinkable just a few years ago. In addition, Wells Fargo has the uncertainty of its several scandals still hanging over it, and it's unclear how long and how deeply they will affect the bank's results.

You can probably guess where this is going. To be clear, I don't think that Wells Fargo is a bad long-term investment. If the company successfully recovers to its previous growth and profitability levels, the current share price could look like a bargain. However, at this point, I have to call Bank of America the better buy of the two.

Matthew Frankel owns shares of Bank of America. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.