NEW YORK — Ten years ago, Congress passed a law intended to penalize chief executive officers whose companies shift their legal addresses to tax havens.

It hasn’t worked out as planned. In the past two years, a fresh wave of companies has fled the U.S. system to avoid hundreds of millions of dollars in taxes.

For example, in October, New Jersey drugmaker Actavis changed its incorporation to Ireland. It helped CEO Paul Bisaro avoid the law’s bite by handing him more than $40 million of stock as much as three years ahead of its schedule, then promising him an additional $5 million to remain with the company.

The 2004 law aimed at reducing the tax benefits of reincorporating overseas has “clearly been a failure,” said Edward Kleinbard, a professor at University of Southern California’s Gould School of Law. “And it now has the perverse result of putting money into executives’ pockets sooner.”

The law imposes a special tax of 15 percent on restricted stock and options held by the most senior executives when a company reincorporates outside the U.S. Since the measure took effect, at least seven large companies have disclosed in securities filings that they risked triggering the tax. All took steps to shield their executives from having to pay.

Three of the companies’ boards simply picked up the tax bill for their executives, maintaining that the managers shouldn’t suffer for a decision that benefits shareholders. Boards at three other companies, including Actavis, helped them avoid the tax altogether by allowing restricted stock to vest early and for options to be exercised. Awarding the equity early raises the risk that the executives might quit or sell their shares, or get paid for meeting goals they never attain.

Since 2012, at least 13 large U.S. companies have announced or completed shifts of legal address, which tax experts call “inversions,” to lower-tax nations such as Ireland and Switzerland.

New York advertising firm Omnicom estimates that a planned incorporation in the Netherlands this year, part of a merger with a French rival, will save the combined company $80 million a year. The cost to the Treasury of the recent wave of address changes may be $500 million a year, estimates Robert Willens, a New York-based tax and accounting consultant.

The statutory U.S. corporate income tax rate of 35 percent is the highest among developed countries, although many companies end up paying less. Lawmakers in both parties and President Obama have endorsed tax code changes that would lower the rate below 30 percent, reducing the incentive to reincorporate overseas. Those proposals have been stymied by disputes over details and what should happen to individual taxes.

Some Democratic lawmakers have introduced legislation that would treat companies managed from the U.S. as domestic even if they’re incorporated elsewhere. Sen. Carl Levin, D-Mich., said last year the change would raise tax revenue by $6.6 billion over 10 years. None of those bills have attracted much Republican support or emerged from committee.

— — —

An earlier flurry of corporate flights to tax havens triggered the 2004 law. Tyco International of Exeter, N.H.; Chicago-based Fruit of the Loom; and Ingersoll-Rand, based in Woodcliff Lake, N.J., incorporated in Bermuda or the Cayman Islands in the late 1990s and early 2000s.

Lawmakers took notice by 2002, when 159-year-old Connecticut toolmaker Stanley Works announced plans to use a Bermuda address. They denounced the company’s CEO and proposed more than 30 different bills to curtail the practice. Connecticut’s attorney general sued, and union officials organized protests in the company’s hometown of New Britain.

“These expatriations aren’t illegal. But they’re sure immoral,” said Charles Grassley of Iowa, then the top Republican on the Senate Finance Committee. Stanley Works eventually dropped the Bermuda plan.

Grassley helped shepherd a series of anti-inversion measures into law in the American Jobs Creation Act of 2004. Some provisions made it harder for companies to get tax savings from incorporating abroad. Acquiring a mailbox in Bermuda was no longer enough.

One route that remains available involves a foreign merger, as long as the partner is at least one-fourth the size of the U.S. firm. Most of the reincorporations since 2004 have been achieved through acquisitions abroad. They include Liberty Global, the Englewood, Colo.-based cable operator, and Tower Group, the New York-based insurer.

So many pharmaceutical companies are switching addresses that bankers are pitching takeovers of Irish drugmakers based on the tax benefits. Gregg Gilbert, a Bank of America drug analyst, dubbed it a “tax rate land grab.”

Another provision in the 2004 law imposed the penalty on CEOs. Since the mid-1990s, the IRS has required stockholders of some companies reincorporating abroad to recognize capital gains on the shares and pay income tax, even if they continue to hold the equity. That rule doesn’t apply to the restricted stock or unexercised options of executives, who technically don’t own the shares. Some lawmakers saw that as an unjustified boon for the CEOs.

“It is only fair for these executives, who are picking the pockets of the American taxpayer to the tune of $4 billion, to feel some of the pinch,” Rep. Richard Neal, D-Mass., said on the House floor in 2002.

— — —

Argonaut Group, a niche insurer in San Antonio, Texas, was one of the first companies to face the new tax on executives’ equity awards. When it acquired a Bermuda address through an acquisition in 2007, Argonaut accelerated its top executives’ awards to avoid the tax, recording an estimated $10.5 million expense, according to a securities filing.

Jazz Pharmaceuticals of Palo Alto, Calif., did the same for its executives when it shifted to Ireland through a 2012 merger. CEO Bruce Cozadd got $3.1 million ahead of schedule, a securities filing shows.

In January, Applied Materials said it would grant $23 million in stock awards to Chairman Michael Splinter ahead of schedule. The Santa Clara, Calif.-based maker of computer-chip equipment plans to buy a Japanese company and incorporate in the Netherlands. Other top executives will get early vesting on only a portion of their equity and must pay taxes on the rest, the filing shows. Some will get extra cash bonuses.

Eaton, a Cleveland-based manufacturer of electrical equipment, and Perrigo, an over-the-counter drugmaker based in Allegan, Mich., opted to pay their executives’ tax bills instead. The cost of these payments can add up because the payments themselves are subject to tax.

The total expense was $11.5 million for Eaton CEO, A.M. “Sandy” Cutler, and an estimated $9.3 million for Perrigo’s Joseph Papa, according to securities filings. Both companies shifted their incorporation to Ireland through acquisitions.

Even with the extra compensation cost, Cutler told analysts, the Irish address would save $160 million a year because of “cash management and resultant tax benefits.”

The board of Endo Health Solutions, a maker of painkillers in Malvern, Penn., weighed both options while making plans to acquire a new address in Ireland, the company said in a securities filing. The board opted to pay the tax, estimated at $7.8 million for CEO Rajiv De Silva, in part because “accelerating the vesting of these performance-based awards could result in unearned compensation being paid” if goals weren’t met.

All the companies declined to comment.

— — —

The biggest disclosed payout has been to Bisaro at Actavis.

After becoming CEO in 2007, he embarked on a series of acquisitions, assembling one of the world’s largest generic drug companies. When bidding for foreign assets against rivals with lower tax rates, he said on a conference call last year, he felt “handicapped.”

For instance, another serial acquirer, Valeant Pharmaceuticals International, is incorporated in Canada and earns much of its profits through subsidiaries in havens such as Bermuda, achieving an effective tax rate of less than 10 percent. Before getting the Irish address last year, company officials said, Actavis’s effective rate was about 28 percent.

Last May, Bisaro announced the $5 billion acquisition of Warner Chilcott, a smaller company incorporated in Ireland that made birth control and acne treatments. He estimated the total cost savings from the takeover at $400 million a year, including the tax savings from using the Irish address, job cuts and other operational changes. He said the combined company’s effective tax rate would be about 17 percent and eventually drop further. On its own, Warner Chilcott’s effective rate was about 11 percent to 12 percent.

Not that Bisaro was packing his bags for Dublin.

“Everybody loves New Jersey too much, so nobody’s willing to go,” Bisaro told analysts on a conference call announcing the deal.

In fact, Warner Chilcott’s top executive, Roger Boissonneault, wasn’t in Ireland either. Once an executive at Warner-Lambert, Boissonneault became president of the Chilcott generics division when it spun off in 1996. As takeovers shifted Warner Chilcott’s ultimate corporate parent to Ireland, Northern Ireland, Bermuda, and back to Ireland, Boissonneault stayed put, leading the company from Rockaway, N.J.

Since becoming CEO, Bisaro has gotten the biggest chunk of his pay in the form of restricted stock, which doesn’t vest until as long as four years after it’s awarded. In the meantime, he can lose it if he misses performance targets or quits. In 2012, restricted stock made up about half of his $8.7 million in compensation.

Because of the special tax due upon reincorporation, Bisaro’s board decided to drop restrictions on Bisaro’s stock when the Warner Chilcott deal was completed — even some that he’d gotten in March that wasn’t due to vest until 2017. Actavis estimated the value of that stock at $40 million in an August filing and said the total amount for the top five officers was $100.8 million. By the time the deal was completed, the stock had gained an additional 13 percent.

Directors reasoned that the executives shouldn’t have to pay a penalty for a transaction that was in the shareholders’ interest, Actavis said in the filing last year. The board chose to accelerate the executives’ stock awards rather than pay the 15 percent penalty because the former option was partly tax-deductible, the company said.

“It’s important to point out that this approach was overwhelmingly approved by the shareholders,” company spokesman David Belian said, declining to comment further. He didn’t respond to a request to speak with Bisaro.

The accelerated stock award triggered an early tax bill for Bisaro, who reported that about half the stock was withheld for tax purposes. Stock awarded as compensation is usually taxed at the same ordinary income rate as wages. Without the acceleration, he would have faced a similar tax bill in the future, whenever the restrictions lapsed.

The law is a classic example of how Congress’s attempts to tweak corporate behavior through the tax code usually backfire, said Kevin Murphy, a professor at USC’s Marshall School of Business who studies executive compensation. “One thing we can always count on is that there will be lots of unintended consequences — usually costly — for shareholders and for taxpayers.”

The accelerated payments may also upend companies’ compensation plans, said Brian Foley, a consultant in White Plains, N.Y., who helps companies set pay. Restricted shares are designed to be earned over time. If officers can cash out their shares immediately, they may no longer have as much reason to stay at the company or contribute to its long-term success, he said.

“I want him or her to have skin in the game,” Foley said. Without restrictions on equity awards, “they can pick up their sticks and leave, and they get to take all that vested stuff with them.”

Indeed, Actavis said last year that it would have to make additional payments to retain Bisaro and his team after allowing them to collect their shares ahead of schedule. Shortly after shifting its address to Ireland, Actavis promised Bisaro the $5 million cash retention bonus, contingent on his remaining at the company through 2016.

Congress should overhaul the whole corporate tax system rather than targeting address shifts, said Bret Wells, a professor at the University of Houston Law Center. U.S. rules allow foreign companies to dodge taxes on their American profits, a process called “earnings stripping,” more easily than domestic companies can.

“Inversion transactions should be a wakeup call,” Wells said. “They should tell us there’s something wrong with our tax system when it’s more valuable to be foreign-owned than U.S.- owned.”

With assistance from Michael Novatkoski in Princeton and Richard Rubin in Washington.