Wells Fargo's earnings keep getting dinged by a laundry list of scandals.

Profit, loans, deposits and revenue all shrank last quarter, Wells Fargo (WFC) said on Friday.

One thing that is going up is expenses. Wells Fargo said operating losses surged 77% last quarter because of various problems in its auto lending, wealth management, mortgage and currency businesses. Overall expenses rose by 3%.

Meanwhile, Wells Fargo said profit declined by 12% during the second quarter, missing Wall Street's expectations. The bank's stock, which has lagged behind the rest of the market, dropped 3% on Friday.

Wells Fargo's legal problems are "obviously having an impact," said Ken Leon, an analyst at CFRA Research. Leon downgraded his rating on Wells Fargo to "sell" following the disappointing results.

"It's a formidable banking franchise, but there's still a lot of work to be done," he said.

Wells Fargo was also hurt by a $481 million income tax bill linked to a recent Supreme Court ruling that allows states to force online retailers to collect sales taxes.

One bright spot: Wells Fargo is returning gobs of money to shareholders thanks to the corporate tax cut and a clean bill of health from the Fed's stress tests. The bank said it plans to raise its dividend by 10% and buy back up to $24.5 billion of stock.

Still, Wells Fargo's results stand in stark contrast to America's biggest bank. JPMorgan Chase (JPM)said on Friday its profits jumped by 18% to $8.3 billion thanks to the "healthy" US economy. That's just shy of JPMorgan's first-quarter haul of $8.7 billion -- which was a record for any US bank.

Related: Wells Fargo accused of misconduct again

Even though the economy is strong, several crucial metrics at Wells Fargo are shrinking.

For instance, average deposits dropped by 2% to $1.3 trillion, led by a drop-off in business from financial institutions. Wells Fargo blamed the decline on actions it had to take due to penalties imposed by the Federal Reserve that prohibit the bank from growing its balance sheet.

Lending, the primary way that banks make money, also dipped by 1% from the first quarter at Wells Fargo. It cited declines for commercial real estate and consumer loans, including auto lending. Mortgage banking profits also declined sharply.

Meanwhile, Wells Fargo is spending heavily to try to win back the trust of customers. The bank recently launched an expensive ad campaign on television, radio and online. Wells Fargo said its advertising and promotion spending jumped 51% last quarter.

It's been a very difficult nearly two years for Wells Fargo. A wave of controversy, kicked off by the fake-accounts scandal, have hurt Wells Fargo's reputation, raised its legal expenses and drawn the ire of regulators.

Wells Fargo has said it doesn't expect to escape the Fed's unprecedented asset cap, which was imposed in February, until next year.

Regulators also charged Wells Fargo a $1 billion fine for forcing customers into unneeded auto insurance and charging them unnecessary mortgage fees.

Wells Fargo said on Friday that it suffered $619 million of operating losses for "previously disclosed matters," including policies, practices and procedures in its foreign exchange business. Wells Fargo previously said that the government has inquired about this unit.

Now, the bank announced it has set aside $171 million to refund customers who may have received unfair foreign-exchange prices. Wells Fargo said this is part of "efforts to make things right and rebuild trust."