In the late nineties, the city of Toledo, Ohio, faced a crisis. DaimlerChrysler, which ran a Jeep factory there, announced plans to build a new plant, but offered no guarantee that it would be built in Toledo. So the city and the state came a-courting. They promised Daimler a ten-year exemption from all property taxes, offered hundreds of millions of dollars in tax credits, and bought out eighty-three homes and sixteen small businesses, in order to give the company more land. Crisis averted: Daimler is still building Jeeps in Toledo.

This arrangement, while extraordinarily generous, is fairly typical. Across the country, cities and states routinely lavish on companies what economists call “location-based incentives.” No one outside of Ohio would have paid Toledo’s largesse much mind had it not been for a surprising development: a few months ago, the Sixth Circuit Court of Appeals, in Cincinnati, found that Daimler’s tax credits in Toledo were unconstitutional. (The Court ruled that the credits interfered with interstate commerce, which only Congress has the power to regulate.) Months, or years, of appeals lie ahead, but, for the moment at least, much of what we know as corporate welfare may be technically illegal.

Thirty years ago, such news wouldn’t have meant much. Cities and states used to lure new businesses the old-fashioned way: cheap labor, low crime rates, good schools, better country clubs. Beginning in the seventies, though, the combination of stagflation, increased global competition, and greater corporate mobility turned local governments into rival suitors showering companies with the Chamber of Commerce equivalents of flowers and chocolates. With tax breaks, cheap loans, and outright giveaways, states and local communities hand out almost fifty billion dollars in incentives every year. The logic is simple enough: businesses create jobs, so governments should do whatever it takes to attract them. And even though tax breaks are rarely the determining factor in where companies choose to go—Irvine, California, for example, has become an auto-industry hub without offering any tax breaks at all—companies would be foolish to turn down free money. So they have mastered the location-shopping racket, pitting cities against each other in search of a sweetheart deal.

The cities are often easy marks. The classic example, of course, is the new sports stadium: a team threatens to leave, and the home town panics, spending hundreds of millions of dollars on a white elephant. But it happens with other businesses as well. New York City has been one of the worst offenders, especially under former Mayor Rudolph Giuliani. It gave hundreds of millions of dollars in tax breaks to firms that weren’t going anywhere; most infamously, Giuliani committed the city to subsidizing a new, billion-dollar headquarters for the New York Stock Exchange, amid implausible threats that it would move to New Jersey. (Michael Bloomberg quashed that plan upon taking office. He also renounced incentives that he’d been granted to keep his own company’s headquarters in New York.) What’s more, corporate welfare is fertile ground for cronyism and political favoritism.

Obviously, cities have reason to dangle a lure. A recent study by Enrico Moretti, of U.C. Berkeley, and Michael Greenstone, of M.I.T., which compared cities that had competed against each other for new plants, found that the winners generally had benefitted—they had slightly higher tax revenues and increased property values. The problem is that though the city with the new plant may be better off, collectively we are all worse off, because the tax money spent on corporate welfare could otherwise go to more productive uses, such as education and infrastructure. For the American economy, it doesn’t matter whether Daimler builds Jeeps in Toledo or Kalamazoo; whatever one city spends to outdo the other is money thrown away.

All public spending distributes benefits unevenly, but the sheer capriciousness of the incentive process makes the inequity worse. Among the plaintiffs in the Toledo case were three of the city’s small businesses, which were understandably annoyed at seeing their tax proceeds padding Daimler’s profits. The corporate-welfare system encourages state and local governments to create an uneven playing field and puts them in the position of deciding which businesses deserve a leg up—in effect, making big bets with public money. When these bets backfire, it can hurt. Last year, Indianapolis lost more than a thousand jobs when United Airlines shut down a maintenance center for which the city, the county, and the state had pitched in hundreds of millions of dollars. And the small town of Galesburg, Illinois, spent a decade plying Maytag with incentives only to watch the company shut down a refrigerator plant and move production to Mexico. The local district attorney has threatened to sue Maytag, but has been opposed by Galesburgers who fear scaring off other businesses.

People in local government know that they should kick the habit. In the early nineties, at a meeting in Washington, D.C., the nation’s governors pledged to invest in “improvements to the general economic climate” rather than in “subsidies for individual projects and companies.” But that pledge didn’t last. States and cities are trapped in a prisoner’s dilemma: as long as one town can woo a corporation with baubles and tax breaks, every town has to be willing to do so. That Toledo decision may be their only hope. The business of America shouldn’t be subsidizing business.