President Obama on Tuesday applauded new rules set by the Treasury that will make it harder for U.S. companies to skirt taxes by moving abroad.

It's a step in the right direction that will give the middle class a fairer shake, the president asserted.

So-called inversions -- whereby a U.S. multinational merges with a foreign company and changes its legal tax residence to another, lower-tax country -- is one way a company can continue to do business in the United States but through a series of maneuvers effectively reduce the amount of money it owes Uncle Sam.

It's perfectly legal. And that's the problem, Obama said. "It's not that they're breaking the laws. It's that the law is so poorly designed."

Related: New crackdown on corporate tax avoidance

And having such legal loopholes in the tax code can "come at the expense of middle class families because that lost revenue has to be made up somewhere," Obama said. "It means that we're not investing as much as we should in schools, in making college more affordable, in putting people back to work, in rebuilding our roads, our bridges, our infrastructure, creating more opportunities for our children."

The new Treasury regulations serve to interpret the spirit and letter of the current law governing foreign mergers. But Obama and others have strongly pushed for Congress to change the law to put a stop to explicit tax-driven mergers. "We shouldn't make it legal to engage in transactions just to avoid taxes," Obama said.

Related: New U.S. tax rules throw $160 billion merger into doubt

The set of rules put out by Treasury this week is the third in two years, and it's considered to be the strongest of the three.

"This guidance is broader than prior guidance, as it applies both to inversions and takeovers by larger foreign companies. And the step is more ambitious legally, as it uses statutory authority never used before," said Steven Rosenthal, a senior fellow at the Urban-Brookings Tax Policy Center.

Some see that broader reach as a problem. "At a time of chronic slow growth, it is unwise to build a regulatory wall against those companies who choose to invest, hire and expand in the United States," said Douglas Holtz-Eakin, president of the American Action Forum, a conservative think tank.

Most people would prefer true business tax reform to adding regulations to govern corporate financial activities. But there are still key disagreements between Democrats and Republicans as to how the corporate tax code should be reformed.