Congress just passed a bank deregulation bill to help tiny community lenders drowning in rules. But some of the biggest winners aren't small at all.

The legislation, which garnered bipartisan support, will benefit thousands of community banks that had little to do with the 2008 financial crisis. Wall Street firms like JPMorgan Chase (JPM) and Goldman Sachs (GS), on the other hand, are not helped.

But the bill will also free large regional banks like Fifth Third Bancorp (FITB) and SunTrust Banks (STI) from tough scrutiny that forced them to build giant rainy-day funds. Wall Street is betting these lenders will be able to return tens of billions of dollars of extra cash through greater share buybacks and dividends.

"They're wrapping themselves in the apple pie of community banking," Neel Kashkari, the president of the Minnesota Federal Reserve Bank, said at an event on Monday. The former Goldman Sachs banker has emerged as an outspoken critic of big banks.

Related: American banks had their most profitable quarter ever

Banks are minting money

Large regional banks, like their mega-bank cousins, are not exactly starving these days. American banks hauled in a record-setting $56 billion of profits during the first quarter, according to the FDIC. Just $6.1 billion of those blockbuster earnings were from community banks.

"They're making record profits. I'm not sure what the problem is there that needs to be solved," said Kashkari.

The American Bankers Association, an industry group, said, "Lawmakers from both parties have chosen to right-size financial rules that were not working as intended and holding the economy back."

The largest financial institutions to get regulatory relief from the bill are State Street and Bank of New York Mellon. These custody banks, which have a combined $624 billion on their balance sheets, are charged with safeguarding the assets of mutual funds and other institutional investors.

By exempting State Street (STT)and Bank of New York Mellon (BK) from certain capital rules, the legislation frees these large firms up to generate greater profits.

Related: Wells Fargo altered documents about business clients

$53 billion reward?

If the deregulation bill becomes law, large regional banks could ramp up shareholder payouts by as much as $53 billion, according to an April report by S&P Global Market Intelligence.

That's because the legislation would allow more than a dozen banks to escape the scrutiny that comes with being labeled a "too big to fail" bank. The trigger for that dreaded distinction would jump to $250 billion in assets, up from just $50 billion today.

Regional banks in the $50 billion to $100 billion would immediately escape the extra regulatory scrutiny, while banks in the $100 billion to $250 billion would have to wait 18 months.

That means banks with healthy balance sheets could crank up their share buybacks and dividends. Lenders may also attempt to do more wheeling and dealing by acquiring smaller banks.

The banks with the most firepower to return cash to shareholders are CIT Group (CIT), Zions (ZION), Citizens Financial (CIWV) and Comerica (CMA), according to research by investment bank KBW.

"Banks are flush with capital," said Brian Gardner, KBW's Washington policy analyst.

Wall Street is already looking forward to bigger payouts, bidding shares of these four banks up by 12% to 16% apiece this year. By comparison, the KBW Bank Index (BKX) is up by a more pedestrian 4% this year.

Markets will pressure banks to return cash

KBW cautioned that it may take years for the large regional banks to fully deploy their extra cash.

Others doubt the windfall for shareholders will ultimately be that massive.

"I don't think there will be a sudden release of capital, although investors and the market may pressure them to do so," said Cliff Stanford, who leads the bank regulatory team at the law firm Alston & Bird.

"The institutions will be thoughtful about it," said Stanford, a former Atlanta Fed official who now represents small and large banks.

The biggest regional banks, PNC (PNC) and US Bancorp (USB), won't be helped because they already sit on more than $250 billion in assets, making them subject to the tougher oversight.

Gardner said that banks hovering near the $50 billion level will no longer be discouraged from crossing that too big to fail threshold. Two examples include New York Community Bancorp (NYCB) and People's United Financial. (PBCT)

"Banks in that range will want to start growing again. They won't be afraid of the compliance costs," he said.

--CNNMoney's Donna Borak contributed to this report