You really can't blame the companies. The board of directors of these companies defecting overseas have a duty to act in the best interest of the shareholders, not Uncle Sam. That included deciding which country to headquarter in.
If Congress passes bills that closes loopholes and discourages inversions, companies will still find new ways around it. It's just like keeping a dog inside the fence. It will find a hole and go free. The owner will fix the hole, and the dog will find another hole. Eventually, all the holes will be fixed. Then, the dog will dig its own hole (I had a dog that did that).
How about encouraging American companies to stay? Out of all the editorials, blog posts, and letters to the editor that I found were in response to the inversion trend, I found one that suggested do that – making the U.S. a tax haven. In Could the U.S. Become a Tax Haven?, Jordan Weissman wrote that the corporate income tax originated in the early 20th century, an era before American. companies went global. As American companies did expand globally, they discovered tax haven countries such as Ireland and the Cayman Islands. Since then, the U.S. has been battling to tax overseas profits. “Instead of fighting tax havens, America could consider joining them,” Weissman wrote in the last sentence of his commentary.
If the United States becomes a tax haven, not only will American companies find it advantageous to stay, they'll find it advantageous to expand in the U.S. instead of elsewhere, and bring overseas operations to the U.S., creating jobs in the U.S. along the way.
A bill has been introduced in both the house and senate that can transform the United States into a tax haven. The FairTax bill (H.R. 25 and S.B.122) proposes a national sales tax on new goods and services to replace the current personal and corporate income tax. As part of the FairTax, all households would get a prebate (a rebate paid in advance) every month for sales tax paid for purchases up to the poverty level for that size of household. The FairTax bill also calls for the repeal of the16th Amendment, the constitutional amendment that authorized the federal income tax.