For years after the financial crisis, Wells Fargo (NYSE:WFC) found itself in a coveted position. By avoiding the worst excesses of the subprime mortgage bubble, the California-based bank was able to grow and gain market share while most other banks were busy licking their wounds.

But things have changed at Wells Fargo. Its fake-account scandal, divulged last year by the Consumer Financial Protection Bureau, tarnished its once-sterling reputation. And even before that came to light, Wells Fargo's earnings had already started to decline.

After six consecutive years of rising earnings, Wells Fargo's net income fell in 2015 by $163 million compared to the prior year. Fortunately, thanks to share buybacks, its earnings per share still grew in 2015, albeit by only a penny per share.

A bar chart showing Wells Fargo's annual earnings.

Data source: Wells Fargo. Chart by author.

In 2016, however, both measures fell. Wells Fargo's bottom line declined by $956 million, while its earnings per share went from $4.18 in 2015 down to $4.03 last year.

It's tempting to blame Wells Fargo's fake-account scandal for the drop. After all, the bank is absorbing elevated legal costs stemming from the scandal, and it's growth has already started to be impacted by Wells Fargo's decision to eliminate sales goals in its branches, which caused new checking account openings and credit card applications to plummet.

But even though Wells Fargo's recent troubles haven't been good for its earnings, they're not the primary source of the decline. That distinction goes to the relationship between Wells Fargo's provision for loan losses relative to its charge-offs.

A Wells Fargo branch sign.

Image source: The Motley Fool.

From 2008 through 2012, Wells Fargo set aside $53.4 billion in loan loss provisions, or about $18 billion a year on average. These are meant to cover future loan losses, which are then charged off when they actually go into default.

But here's the thing: In 2008, Wells Fargo set aside $8.1 billion more than it charged off. And in 2009, its provisions exceeded its charge-offs by $3.5 billion. By doing so, Wells Fargo was adding to its loan loss allowance, which it could then draw from to cover charge-offs in future periods.

A bar chart comparing Wells Fargo's net charge-offs to its provision expense.

Data source: Wells Fargo. Chart by author.

And that's exactly what Wells Fargo did between 2010 and 2015. In each of those years, the nation's third biggest bank by assets charged off more than it recorded as a provision expense, relying on releases from its existing loan loss reserves to cover the difference.

In 2013, for instance, Wells Fargo charged off $4.5 billion worth of soured loans, but only recorded a $2.3 billion provision expense.

But this gap closed considerably in 2015, when the bank's charge-offs exceeded its provisions by $450 million. And by 2016, it had reversed, as Wells Fargo set aside more than it charged off the previous year.

These are the forces, in turn, that have caused Wells Fargo's earnings to fall for two consecutive years, as the year-over-year increase in its provision expense exceeded $1 billion in both 2015 and 2016, while its net income in those periods fell by $163 million and $956 million, respectively.

John Maxfield owns shares of Wells Fargo. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.