Fannie Mae and Freddie Mac have loosened rules that would have kept banks from approving new mortgages during the government shutdown

In the latest sign of unrest among private shareholders of Fannie Mae (OTCBB:FNMA) and Freddie Mac (OTCBB:FMCC), hedge fund Perry Capital LLC filed a lawsuit against the U.S. Treasury in a federal court in the District of Columbia, on Sunday, alleging that the 2012 amendments made to the bailout terms set for the two firms were illegal.

New York-based Perry Capital challenged the government’s takeover of the mortgage giants during the financial crisis and the subsequent “sweep amendment” in 2012, which altered the original terms of the acquisition. The fund claimed, according to the lawsuit, that the alteration violates private investors’ rights as it prevents the two firms from building their own capital.

“The third amendment fundamentally and unfairly alters the structure and nature of the securities Treasury purchased,” according to the court papers. “This blatant overreach by the federal government to seize all of the companies’ profits at the expense of the companies and all of their private investors is unlawful and must be stopped.”

The lawsuit names the Federal Housing Finance Agency, or FHFA, which regulates Fannie and Freddie, and the government-owned agencies themselves as defendants in addition to the Treasury department. Perry Capital claimed that the 2012 amendment, which gave the government the right to all profits of the two companies instead of a 10-percent dividend based on a previous deal, is illegal.

The changes in the rule have facilitated a steady flow of revenue to the federal government as the housing sector has recovered since the 2008 crisis that was mainly brought on by subprime loans made by lenders, and both mortgage companies are now turning profits. In April, an influx of cash from Fannie Mae and Freddie Mac -- to the tune of $95 billion -- helped the U.S. government post a budget surplus.

The move to sue the government comes at a time when Congress is debating liquidating the mortgage giants. Last month, a group of senators had introduced a bipartisan bill that would gradually wind down the two firms.

The minority shareholders of the companies and several other investment groups have been lobbying for relieving Fannie and Freddie from government control, advocating that the government should treat the revenues from the mortgage companies as repayment of its debt.

However, analysts believe that the government is unlikely to see these returns as capital repayments and would treat the revenue as returns on their investment in the companies.

In June, shareholders represented by Seattle-based law firm Hagens Berman Sobol Shapiro had sued the U.S. government seeking damages of $41.5 billion for taking over the mortgage giants in 2008.