The last five years have been anything but kind to the vast majority of banks in the United States. Nearly 500 lenders have failed since the financial crisis, and few, if any, new ones have set up shop.

For a select few, however, the hard times have been a veritable windfall. The lesson? In times of trouble, good banks become great banks.

You can see this in the figure below, which charts the change in book value per share (with dividend payouts added back in) at the nation's largest commercial lenders between the beginning of 2008 and the end of 2012.

The right side of the figure is populated by seven banks that succumbed to the siren song of subprime mortgages.

In Huntington Bancshares' case, it made the fateful decision to acquire Sky Financial in 2007 and thereby assumed liability for a sizable portfolio of subprime mortgages that had been originated and then held for investment by Franklin Credit Management Corporation. The slip led to a $3.7 billion loss before taxes in 2009.

The same can be said for Bank of America (BAC 2.50%), which made a similar, albeit larger, mistake when it purchased Countrywide Financial. In the intervening time period, the acquisition has cost the nation's second biggest bank by assets upwards of $50 billion -- and the expenses are still accruing.

By comparison, the left side of the figure is populated by lenders that refused to abandon sensible lending strategies and were thereby positioned to exploit the weakness of their competitors. U.S. Bancorp (USB 0.95%) is obviously chief among them, more than doubling its dividend-adjusted book value since the beginning of 2008.

But even more than U.S. Bancorp, Wells Fargo (WFC 1.92%) and PNC Financial (PNC 2.12%) serve as poster children for the proposition that good banks become great banks in times of trouble. By avoiding the pitfalls of their competitors, Wells Fargo and PNC were positioned to absorb them for pennies on the dollar -- Wells through its acquisition of Wachovia and PNC via its purchase of National City Corporation.

For investors, the point is this: If you care about your capital but nevertheless want to invest in banks, then you should become as intimately familiar as possible with their credit policies and, perhaps more importantly, their adherence thereto.