Hundreds of small banks that received US aid after the financial crisis appear to have found a creative way to repay the funds: obtain money from a different government program.

Most of the 627 banks that still hold money from the controversial Troubled Asset Relief Program, or TARP, have filed applications to roll the obligations into the government’s new Small Business Lending Fund, according to Treasury officials and the banks.

That includes at least two Massachusetts banks, Mercantile Capital Corp. in Boston and Central Co-operative Bank in Somerville.

TARP was widely tarred as a bailout for greedy banks, but the $30 billion small business lending program does not carry the same baggage. The new program would let many TARP recipients sharply reduce dividend payments to the government, while no longer facing strict restrictions on executive compensation.

“It’s a great deal’’ for banks, said Linus Wilson, assistant professor of finance at the University of Louisiana Lafayette, who has been tracking the programs. “The Small Business Lending Fund does not have the stigma that the TARP does.’’

For instance, Mercantile Capital, the parent of Mercantile Bank in Boston, has applied for more than $4 million in funding from the new program to replace the $3.5 million it received through TARP. The bank said it expects the funds to cost just 1 percent a year under the new small business lending program, compared to the 5 percent it pays now (and 9 percent in 2014) under TARP.

“It makes all the sense in the world’’ to switch, said Charles Monaghan, the bank’s chief executive.

TARP was created under the Bush administration in the midst of the financial crisis three years ago to pump capital into the financial system to allay fears the system might collapse. The Obama administration and Congress created the Small Business Lending Fund to increase lending by small and mid-size banks.

“The purpose of the [Small Business Lending Fund] is to encourage Main Street banks and small businesses to work together to help create jobs and promote economic growth,’’ said Colleen Murray, a Treasury Department spokeswoman.

But critics have derided the program as another bailout, nicknaming it TARP Jr. or Son of TARP.

At a hearing in May, Republican Senator Olympia J. Snowe of Maine questioned whether it was proving “largely to be a new TARP refinancing program.’’

The Treasury Department, which plans to begin approving applications for the program as early as next month, said it received 847 applications, including 315 from banks still holding TARP money.