Founded in 1993 by brothers Tom and David Gardner, The Motley Fool helps millions of people attain financial freedom through our website, podcasts, books, newspaper column, radio show, and premium investing services.

Shareholders in Bank of America are now being rewarded for their patience.

It's been three years in the making, but it's finally happened: Bank of America(NYSE:BAC) emerged from both rounds of this year's stress test unscathed, clearing the way for the nation's second biggest bank by assets to boost its dividend by 50% and repurchase $5 billion worth of stock over the next 12 months.

After the market closed on Thursday, the Federal Reserve released the results from the stress test's second round, the comprehensive capital analysis and review, or CCAR. While shares of Bank of America were up nearly 4% during the trading day, they've headed even higher in after-hours trading in response to the news.

"Over the last few years, we have significantly strengthened our company and increased our earnings as we execute a straightforward strategy focused on responsible growth," said chairman and CEO Brian Moynihan. "This improvement has allowed us to take a significant step toward returning more capital to shareholders."

The purpose of the first round of the stress test, the results of which were announced last week, is to determine whether the nation's biggest banks have enough capital to survive a severe economic downturn. The second round then examines banks' capital planning processes and approves or denies requests to boost dividends and/or share repurchase programs.

Bank of America sailed through this year's first round with far more capital than it needed to satisfy regulators. It entered the Fed's hypothetical nine-quarter scenario, which resembled a combination of the 2008 financial crisis and the 2011 European sovereign debt crisis, with a common equity tier 1 capital ratio of 11.6% and exited with a 8.1% ratio. The latter comfortably exceeded its regulatory minimum 5.9% common equity tier 1 capital ratio. (Click here to see three charts that reflect this performance.)

But even though Bank of America passed muster on the first round of the stress tests over the past two years -- the quantitative round -- it has struggled on the second round -- the qualitative round. In 2014, it belatedly discovered that it had mismarked the value of debt securities inherited in its 2008 acquisition of Merrill Lynch. This led the Fed to require the bank to resubmit its capital plan and suspend planned increases in capital distributions until the issue was resolved, which it was.

Last year, meanwhile, the Fed took issue with Bank of America's capital planning process more generally. The North Carolina-based bank was thus required to submit a new capital plan to "address certain weaknesses" in its processes, though the bank was nevertheless allowed to boost its share buyback plan.

The consequences of these struggles have been threefold. First, Bank of America rearranged the executives in charge of its annual stress test submission. Second, the issues have fueled skepticism among investors, which helps explain why its shares continue to trade for a nearly 20% discount to tangible book value eight years after the financial crisis. And third, unlike many of its peers, who have raised their dividends annually since 2011, Bank of America has boosted its quarterly payout only once -- in 2014.

One consequence of retaining so much capital is that Bank of America's return on equity is roughly half its 12% cost of capital. Over the last 12 months, for instance, it returned only 6.6% on its equity. That compares to an 8.7% average on the KBW Bank Index, which tracks shares of the nation's 24 biggest commercial banks. Meanwhile, Wells Fargo's return on equity over the same period is 13.3%, according to data from YCharts.com. This also goes a long way toward explaining why Bank of America's shares trade for such a large discount to its tangible book value.

Given its performance on this year's test, though, it's reasonable to assume that this valuation gap will begin to close. And if Bank of America is able to follow this up with a good earnings performance next month, investors could see them head even higher.

John Maxfield owns shares of Bank of America and Wells Fargo. The Motley Fool owns shares of and recommends Wells Fargo. The Motley Fool recommends Bank of America. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.