A Bank of America branch in New York. Scott Mlyn | CNBC

The two biggest U.S. banks each just posted record first-quarter profit, the result of years of work building coast-to-coast franchises that have attracted billions in customer deposits. On Friday, J.P. Morgan Chase said it made $9.2 billion in the first three months of the year. Bank of America said Tuesday that it generated $7.3 billion. But investors' darkest fear about the industry – that if the Federal Reserve really is done raising rates for the foreseeable future, banks' main profit-making engine will sputter – is becoming apparent. Bank of America just posted more quarterly profit than at any time in its history this week, but analyst Matthew O'Connor was worried about what next year looks like. The bank's CFO warned that growth in net interest income would slow by half to 3 percent this year, below some analysts' estimates.

"It seems like revenue growth is going to flatten out as we get into 2020, and I'm just wondering what you're thinking in terms of levers that can be pulled?" O'Connor asked Tuesday, adding that it was "obviously not just a concern for Bank of America." The problem: More than anything else that banks do, investors value net interest income, or the revenue that banks garner from collecting loan payments, minus the interest it pays to depositors. When the Federal Reserve raises rates, as it did four times last year, banks pocket more money as they charge more for loans. But last month the Fed indicated it would hold off on raising rates this year amid slowing economic growth around the world. That sent yields on longer term debt down, even inverting segments of the so-called yield curve, impacting banks' net interest income.

Dark clouds

"The thing that gets the highest price-to-earnings value is net interest income, and that was just killed by what the Fed did," said Charlie Peabody, an analyst at Portales Partners. "The flatness of this yield curve can endure, which is very negative for banks." Bank of America wasn't the only one to issue a warning. Wells Fargo shares tanked Friday after the firm said net interest income would fall by as much as 5% this year. And Wednesday, Bank of New York Mellon shares plunged after the firm said the yield curve would crimp revenue growth for the next several quarters. The NII outlook is a dark cloud on an otherwise strong quarter for banks' Main Street lending operations. J.P. Morgan, the biggest U.S. bank by assets, beat analysts' expectations on strength in its retail banking division, where profit surged 19 percent to $3.96 billion. It was a similar story at Bank of America, the second largest U.S. bank, which posted a 25% increase in profit to $3.2 billion at its retail bank. And on Monday, investors punished Citigroup, the third biggest U.S. bank, amid signs that its consumer bank was failing to gain traction. A tough quarter for Wall Street trading and investment banking punished Goldman Sachs and Morgan Stanley, which are less diversified than their larger peers.

Peak earnings