Toronto-Dominion Bank (TD 0.19%) -- more commonly referred to as TD Bank -- has been a terrific long-term investment. During the past 30 years, the shares have increased in value by more than 3,300%. The S&P 500, for comparison, rose in value by just 1,400% during the same time period.

More recently, however, TD Bank stock has lagged behind the market. During the past three years, the shares have essentially been little changed while broad market indexes have soared. And just last week, we got news that sent the shares tumbling by more than 6%. If you're a patient investor, might this be the buying opportunity you've been waiting for?

What's the problem with TD Bank?

Let's get to the bad news first. TD Bank has become the largest U.S. bank in history to plead guilty to failures under the Bank Secrecy Act, which also makes it the first bank ever to plead guilty to conspiracy to commit money laundering.

These guilty pleas stemmed from a U.S. government investigation that found the bank helped launder hundreds of millions of dollars in funds. "By making its services convenient for criminals, it became one," said U.S. Attorney General Merrick Garland. Ouch.

What are the penalties involved? TD Bank is being forced to pay roughly $3 billion in fines. But just as important, the ruling institutes an asset cap, preventing the company from growing any bigger than it is today.

The last time such an asset cap was implemented was in 2016, when Wells Fargo (WFC -0.91%) faced scrutiny over creating millions of user accounts without customer permission in order to boost growth figures. Nearly a decade later, that asset cap is still in place, but Wells Fargo is currently trying to have it lifted. As with TD Bank, Wells Fargo also agreed to pay roughly $3 billion in fines in addition to the asset cap.

On the day the news hit this week, TD Bank stock lost around 6.5%, representing nearly $7 billion in lost value -- more than double the fine amount. Is this a buying opportunity?

Lessons from Wells Fargo

To put these issues into context, it's helpful to review what happened to Wells Fargo in the years after its scandal. From 2016 through today, the bank has significantly underperformed the overall market. The banking industry in general has lagged behind the market in recent years, but it's clear that Wells Fargo's tarnished reputation -- plus the asset cap that essentially prevented any growth in its asset base -- hindered any potential of value creation.

^SPXTR Chart

^SPXTR data by YCharts.

How long might TD Bank be subject to its asset cap? If Wells Fargo is any indication, it could be a decade or more. That's a problem considering TD Bank's history of success has allowed it to trade at a premium valuation for years. The shares now trade at 1.4 times book value after this week's correction.

Wells Fargo, for comparison, trades at just 1.2 times book value. Back in 2016, right before the bad news broke, The stock was trading in line with where TD Bank trades now: right around 1.4 times book value.

TD Bank has historically trounced Wells Fargo when it comes to return on equity, a primary measure of how much a bank earns for its shareholders. But the new asset cap -- which could be in place for many years -- probably will prove to be a severe impediment to growth, just like what happened when Wells Fargo faced a similar asset cap.

There's no doubt that TD Bank stock is cheaper today in some senses than it was last week. But the company is also fundamentally different. Management no longer is in control of the company's future, and that's typically not the type of company you want to bet on.

After the Wells Fargo scandal, Warren Buffett slowly began selling all of his stake, even though his Berkshire Hathaway had owned shares in the company for many years. That turned out to be a wise move, and the same might prove true for TD Bank today.

Perhaps there's a valuation at which the shares once again become a buy. But the potential long-term nature of the asset cap should deter investors looking to jump in at a perceived discount.