APPLE HAS BROUGHT American consumers such popular wonders as the iPad, iPod and iPhone and earned billions of dollars in the process. It’s in hot water with Congress now, however, because of something it has not done: regularly paid the top U.S. corporate income tax rate of 35 percent on every dollar it earns around the world. From 2009 to 2012, in fact, Apple managed to avoid taxes on nearly a third of its worldwide net profits, some $30 billion, which were booked to its Irish subsidiaries, according to a report by the U.S. Senate Permanent Subcommittee on Investigations. Apple’s actions “undermine the fairness of the U.S. tax code,” the report says.

We would say rather that Apple’s actions demonstrate the unfairness of the tax code — or at least its hopeless complexity. As a tax-law expert witness explained to the subcommittee Tuesday, everything the company did was arguably legal under U.S. and Irish tax law. Apple’s Irish subsidiary was not registered in the United States, so it owed no tax on this side of the Atlantic; but, under Irish law, Apple was not liable for taxation in Ireland either, since it is not managed and controlled in that country. Actually, most of the money wasn’t taxed anywhere.

Nor is Apple the only U.S. multinational corporation to avail itself of such loopholes. Companies do so as a rational response to the fact that the top U.S. corporate rate is high by international standards. “Apple serves its shareholders by keeping these funds overseas where they can be deployed efficiently to fund international operations at a lower cost,” CEO Tim Cook candidly told the committee. Not only that, but, as Mr. Cook also said, the high U.S. corporate tax rate made it rational for Apple to issue billions of dollars in low-interest debt rather than repatriate its cash.

That Apple and others behaved legally does not mean that they behaved beneficially, from society’s point of view. As subcommittee chairman Sen. Carl Levin (D-Mich.) pointed out, the net effect of Apple’s tax avoidance is to raise the tax burden on everyone else. Yes, Apple pays $6 billion per year in federal taxes, and that’s a lot of money — but not commensurate with its heft in the U.S. economy. The billions Apple and other firms hoard overseas are billions not working to create jobs here.

The Apple case illustrates, seemingly for the millionth time, the need for corporate tax reform, a need already recognized by everyone from the Obama administration’s Treasury Department to the Republican chairman of the House tax-writing committee. There is also broad consensus that reform should consist of closing loopholes in return for lower rates. Mr. Cook himself said Apple would accept such a deal even if it raised its tax burden.

Alas, it is far, far easier to describe a more efficient corporate code than to enact one. The taxation of global income has proven an especially thorny problem, in part because it is so difficult to define objectively, and in part because it’s so difficult to harmonize the tax codes of different nations. Still, the difficulty of the task is no reason to shrink from it. As the exposure of Apple’s stunning tax strategies shows, Americans have already paid a high price for their current flawed tax code.