Drugmaker AbbVie announced an agreement on a $54.7 billion merger with Britain's Shire designed to slash AbbVie's tax bill by moving its legal home out of the United States.

The deal, which has been in the works since May, is controversial because it is the latest attempt by the company to cut its U.S. corporate tax bill through a merger.

The announcement said AbbVie will cut its effective tax rate to about 13 percent by 2016 from 26 percent in 2011. The combined company will keep its operational headquarters in Chicago, and continue to have its shares traded in New York, even though its legal home will be in the United Kingdom.

A U.S. company can't simply relocate to nations with lower tax rates to avoid U.S. corporate taxes. To get the lower foreign tax rate, it must use a process known as "inversion," in which a merger leads to a foreign partner owning more than 20% of the stock in the combined company.

Treasury Secretary Jack Lew this week urged Congress to act to prevent the move by U.S. companies.

"Congress should enact legislation immediately -- and make it retroactive to May 2014 -- to shut down this abuse of our tax system," Lew wrote in a letter to Senate Finance Committee Chairman Ron Wyden, an Oregon Democrat.

The practice is becoming more common. The Congresional Research Service issued a report earlier this month showing 47 companies using inversion to cut their tax bill in the last decade, up from 29 during the previous 20 years.

Besides the AbbVie-Shire deal, drugmaker Mylan announced a deal this week to buy a non-U.S. unit of Abbott in a $5.3 billion stock deal designed to let it incorporate in the Netherlands. Pfizer tried a similar move earlier this year, but its bid was rejected by British drugmaker AstraZeneca.