In the end, the money that towns across America gave General Motors did not matter.

When the automaker released a list of factories it was closing during bankruptcy three years ago, communities that had considered themselves G.M.’s business partners were among the targets.

For years, mayors and governors anxious about local jobs had agreed to G.M.’s demands for cash rewards, free buildings, worker training and lucrative tax breaks. As late as 2007, the company was telling local officials that these sorts of incentives would “further G.M.’s strong relationship” with them and be a “win/win situation,” according to town council notes from one Michigan community.

Yet at least 50 properties on the 2009 liquidation list were in towns and states that had awarded incentives, adding up to billions in taxpayer dollars, according to data compiled by The New York Times.

Some officials, desperate to keep G.M., offered more. Ohio was proposing a $56 million deal to save its Moraine plant, and Wisconsin, fighting for its Janesville factory, offered $153 million.

But their overtures were to no avail. G.M. walked away and, thanks to a federal bailout, is once again profitable. The towns have not been so fortunate, having spent scarce funds in exchange for thousands of jobs that no longer exist.

One township, Ypsilanti, Mich., is suing over the automaker’s departure. “You can’t just make these promises and throw them around like they’re spare change in the drawer,” said Doug Winters, the township’s attorney.

Yet across the country, companies have been doing just that. And the giveaways are adding up to a gigantic bill for taxpayers.

A Times investigation has examined and tallied thousands of local incentives granted nationwide and has found that states, counties and cities are giving up more than $80 billion each year to companies. The beneficiaries come from virtually every corner of the corporate world, encompassing oil and coal conglomerates, technology and entertainment companies, banks and big-box retail chains.

The cost of the awards is certainly far higher. A full accounting, The Times discovered, is not possible because the incentives are granted by thousands of government agencies and officials, and many do not know the value of all their awards. Nor do they know if the money was worth it because they rarely track how many jobs are created. Even where officials do track incentives, they acknowledge that it is impossible to know whether the jobs would have been created without the aid.

“How can you even talk about rationalizing what you’re doing when you don’t even know what you’re doing?” said Timothy J. Bartik, a senior economist at the W.E. Upjohn Institute for Employment Research in Kalamazoo, Mich.

The Times analyzed more than 150,000 awards and created a searchable database of incentive spending. The survey was supplemented by interviews with more than 100 officials in government and business organizations as well as corporate executives and consultants.

A portrait arises of mayors and governors who are desperate to create jobs, outmatched by multinational corporations and short on tools to fact-check what companies tell them. Many of the officials said they feared that companies would move jobs overseas if they did not get subsidies in the United States.

Over the years, corporations have increasingly exploited that fear, creating a high-stakes bazaar where they pit local officials against one another to get the most lucrative packages. States compete with other states, cities compete with surrounding suburbs, and even small towns have entered the race with the goal of defeating their neighbors.

While some jobs have certainly migrated overseas, many companies receiving incentives were not considering leaving the country, according to interviews and incentive data.

Despite their scale, state and local incentives have barely been part of the national debate on the economic crisis. The budget negotiations under way in Washington have not addressed whether the incentives are worth the cost, even though 20 percent of state and local budgets come from federal spending. Lawmakers in Washington are battling over possible increases in personal taxes, while both parties have said that lower federal taxes on corporations are needed for the country to compete globally.

The Times analysis shows that Texas awards more incentives, over $19 billion a year, than any other state. Alaska, West Virginia and Nebraska give up the most per resident.

For many communities, the payouts add up to a substantial chunk of their overall spending, the analysis found. Oklahoma and West Virginia give up amounts equal to about one-third of their budgets, and Maine allocates nearly a fifth.

In a few states, the cost of incentives is not significant. But several of them have low business taxes — or none at all — which can save companies even more money than tax credits.

Far and away the most incentive money is spent on manufacturing, about $25.5 billion a year, followed by agriculture. The oil, gas and mining industries come in third, and the film business fourth. Technology is not far behind, as companies like Twitter and Facebook increasingly seek tax breaks and many localities bet on the industry’s long-term viability.

Those hopes were once more focused on automakers, which for decades have pushed cities and states to set up incentive programs, blazing a trail that companies of all sorts followed. Even today, G.M. is the top beneficiary, public records indicate. It received at least $1.7 billion in local incentives in the last five years, followed closely by Ford and Chrysler.

A spokesman for General Motors said that almost every major employer applied for incentives because they help keep companies competitive and retain or create jobs.

“There are many reasons why so many Ford, Chrysler and G.M. plants closed over the last few decades,” said the G.M. spokesman, James Cain. “But these factors don’t mean that the companies and communities didn’t benefit while the plants were open, which was often for generations.”

Mr. Cain cited research showing that the company received less money per job than foreign automakers operating in the United States.

Questioned about incentives, officials at dozens of other large corporations said they owed it to shareholders to maximize profits. Many emphasized that they employ thousands of Americans who pay taxes and spend money in the local economy.

For government officials like Bobby Hitt of South Carolina, the incentives are a good investment that will raise tax revenues in the long run.

“I don’t see it as giving up anything,” said Mr. Hitt, who worked at BMW in the 1990s and helped it win $130 million from South Carolina.

Today, Mr. Hitt is the state’s secretary of commerce. South Carolina recently took on a $218 million debt to assist Boeing’s expansion there and offered the company tax breaks for 10 years.

Mr. Hitt, like most political officials, has a short-term mandate. It will take years to see whether the state’s bet on Boeing bears fruit.

In Michigan, Gov. Rick Snyder, a Republican in his first term, has been working to eliminate most business tax credits but is bound by past awards. The state gave General Motors $779 million in credits in 2009, just a month after the company received a $50 billion federal bailout and decided to close seven plants in Michigan.

G.M. can use the credits to offset its state tax bill for up to 20 years. “You don’t know who will take a credit or when,” said Doug Smith, a senior official at the state’s economic development agency. “We may give a credit to G.M., and they might not take it for three years or 10 years or more.”

One corporate executive, Donald J. Hall Jr. of Hallmark, thinks business subsidies are hurting his hometown, Kansas City, Mo., by diverting money from public education. “It’s really not creating new jobs,” Mr. Hall said. “It’s motivated by politicians who want to claim they have brought new jobs into their state.”

For Mr. Hall and others in Kansas City, the futility of free-flowing incentives has been underscored by a border war between Kansas and Missouri.

Soon after Kansas recruited AMC Entertainment with a $36 million award last year, the state cut its education budget by $104 million. AMC was moving only a few miles, across the border from Missouri. Workers saw little change other than in commuting times and office décor. A few months later, Missouri lured Applebee’s headquarters from Kansas.

“I just shake my head every time it happens, it just gives me a sick feeling in the pit of my stomach,” said Sean O’Byrne, the vice president of the Downtown Council of Kansas City. “It sounds like I’m talking myself out of a job, but there ought to be a law against what I’m doing.”

Outgunned by Companies

For local governments, incentives have become the cost of doing business with almost every business. The Times found that the awards go to companies big and small, those gushing in profits and those sinking in losses, American companies and foreign companies, and every industry imaginable.

Workers are a vital ingredient in any business, yet companies and government officials increasingly view the creation of jobs as an expense that should be subsidized by taxpayers, private consultants and local officials said.

Even big retailers and hotels, whose business depends on being in specific locations, bargain for incentives as if they can move anywhere. The same can be said for many movie productions, which almost never come to town without local subsidies.