Image source: iStock/Thinkstock.

JPMorgan Chase (JPM 1.44%) and Bank of America (BAC 1.70%) are the nation's two biggest banks by assets. But aside from this similarity, the investment thesis behind these two megabanks is very different. Whether one is a better buy than the other, in turn, boils down to your investment objectives.

The difference between these two banks insofar as investors are concerned traces its roots back to the financial crisis. Bank of America just barely survived the crisis. Thanks to its acquisition of Countrywide Financial in particular, it has suffered upwards of $200 billion worth of losses stemming principally from imprudent bets on the subprime mortgage market. The net result is that Bank of America has had to spend the intervening years retreating and retrenching.

JPMorgan Chase, on the other hand, not only survived the crisis, but arguably thrived as a result of it. Thanks to the prudent leadership of Jamie Dimon, the $2.4 trillion bank was in a position to acquire both Bear Stearns and Washington Mutual for pennies on the dollar. These added to JPMorgan Chase's investment banking operations (in the case of Bear Stearns), and to its deposit franchise and retail branch footprint (in the case of Washington Mutual).

The net result of these divergent paths can be seen in these banks' stock prices even today. Bank of America's shares trade for a 40% discount to book value, whereas JPMorgan Chase's stock trades for right around its book value.

From a valuation perspective, then, it seems obvious that Bank of America's stock is a better buy right now than JPMorgan Chase's. And to a certain extent, this is true -- at least in the short-run. This follows from the fact that there is substantial upside to Bank of America's stock based on valuation alone, as most banks in normal times trade for 1 or more times book value.

Lest there be any doubt, moreover, as I've discussed in the past, it seems reasonable to assume that Bank of America will eventually return to generating respectable profitability at some point. It still has progress to make in this regard, given that its return on assets last year was only 0.74% whereas its goal is to surpass the common industry benchmark of a 1% return on assets.

But this isn't to say that JPMorgan Chase isn't a buy, too. The difference lies in your investment horizon. If you're a long-term investor that's looking for a bank stock that will generate higher returns over, say, one or two decades, then JPMorgan Chase is likely the more prudent bet. It already earns roughly 1% on its assets, and it's the leading investment bank on Wall Street. The higher profitability that JPMorgan Chase is likely to record should accordingly translate into higher shareholder returns and, even more important, a faster compound annual growth rate if one's investment is given the time to season.

In sum, if you're looking for a short-term valuation play, then Bank of America seems to be the better buy now. But if you're a buy-and-hold investor that intends to keep your position through multiple credit cycles, then the preference shifts to JPMorgan Chase.