Bank of America is minting money thanks to tax cuts, turbulent markets and the stronger economy.

America's second-largest bank hauled in $6.9 billion in profit during the first three months of 2018. That's the biggest quarterly profit in Bank of America's history, taking out the previous record set in 2011.

The blockbuster earnings are at least partly because of President Trump's corporate tax cuts.

Bank of America (BAC) paid Uncle Sam $1.5 billion in income tax, down 26% from last year, even though overall profit soared 30%.

The bank said the tax law lowered its effective tax rate by 9 percentage points. The new corporate tax rate is 21%, down from 35%.

Without the gift of the tax law, Bank of America's results would have been less stellar. Pretax income rose a more modest 15%, while revenues ticked up just 4%.

Like other Wall Street firms, Bank of America benefited from the recent market mayhem. Clients rushed to execute buy and sell trading orders as they watched the Dow gyrate.

Bank of America's sales and trading revenue jumped 6% to $4.1 billion. The bank said stock trading revenue surged by 38% to $1.5 billion. The company cited "increased client activity" and a strong trading performance in futures, options and other complex securities.

That helped offset a 13% decline in the trading of bonds, currencies and commodities trading revenue.

Even as many retail investors watched their investment portfolios shrink, Bank of America made money in its trading division on every day of the first quarter.

Related: Regulators push to shrink banks' rainy-day fund by $121B

The healthy economy, both at home and abroad, also padded Bank of America's bottom line.

Consumer banking revenue jumped 9% to $9 billion. Loans climbed 8%, and deposits ticked higher.

Bank of America disappointed some analysts because it beat estimates by cutting expenses, not because of stronger lending. The size of the bank's loan book rose just slightly last quarter.

"If loan growth doesn't materialize, then expenses might not matter," Brian Kleinhanzl, an analyst at Keefe, Bruyette & Woods, wrote to clients on Monday.

Bank of America isn't the only bank recording mega profits. JPMorgan Chase (JPM), the largest US bank, reported a 35% jump in earnings on Friday. The $8.7 billion profit was the largest by any US bank in history, according to S&P Global Market Intelligence.

Despite Bank of America's financial success, the company cut its number of employees by 2,600, or 1%, over the past year. The company rewarded most employees with a one-time tax cut bonus of $1,000.

Large banks also continue to shut branches. Bank of America now has 4,435 branches across the United States. That's down from 4,559 a year ago and 6,139 at the end of 2008, according to FactSet.

Customers continue to do more banking online. Bank of America counted 24.8 million active mobile banking users last quarter, up 12% from last year.