Walmart and Kroger are deploying robots to scan shelves, mop floors and pack delivery bags, but these companies are also doing something else: lowering their taxes.

While politicians promise to protect American workers from immigrant labor, our elected representatives are encouraging employers to develop smarter and stronger machines to replace us. Every time a company lays off a human and buys a robot, they get a tax break under the federal tax code.

Robots are becoming more agile, and artificial intelligence is taking on more difficult tasks. Americans, therefore, need to reconsider whether our government should incentivize companies to eliminate jobs.

The problem begins with U.S. payroll and employment taxes, which are the largest income source for the federal government.

On HoustonChronicle.com: Automation could hollow out the American workforce

Employers withhold a portion of our income to pay our personal income taxes, Social Security and Medicare contributions. But realistically, these paycheck deductions tax employers by forcing them to pay higher salaries.

Businesses can deduct some of these costs from their income taxes, but under current law, money borrowed and spent on robots garner additional deductions and even tax credits. On balance, the tax code punishes the employment of people while subsidizing automation, according to MIT and Boston University economists in a paper called “Artificial Intelligence, Automation and Work.”

Professors Daron Acemoglu and Pascual Restrepo found that when given a choice between fallible humans and low-performance machines, most employers choose automation just for the tax advantages. Not to mention, the challenges of managing humans make simple machines preferable.

Two years ago, Microsoft founder Bill Gates publicly suggested tipping the scales back in the humans’ direction when he argued that man and machine should be equal before the tax code. Politicians and business leader ridiculed his recommendation at the time.

The proposal is gaining ground, though, as robots replace cooks and artificial intelligence replaces accountants. More American workers are beginning to wonder whether they will be next and want protection.

In defense of technological progress, I have written often about how industrial revolutions create more new jobs than they eliminate. Older, less-educated workers undoubtedly suffer and face difficulty finding work, but their children typically obtain a higher standard of living.

Acemoglu and Restrepo, though, say the artificial intelligence revolution is too fast and too comprehensive and will lead to millions of layoffs without creating enough new jobs.

To prevent a violent revolt by unemployed workers, some liberal and conservative economists have begun debating a universal basic income. They propose that in place of social services, the government should issue a check to cover basic food, shelter, clothing and health care. No one would have to work, but those who do would improve their standard of living.

Taxing robots could pay for it, U.S. Rep. Alexandria Ocasio-Cortez of New York told the SXSW Interactive Conference in Austin last month.

“We should not be haunted by the specter of being automated out of work,” she said. “We should be excited by that. But the reason we’re not excited by it is because we live in a society where if you don’t have a job, you are left to die. And that is, at its core, our problem.”

An automation tax that creates a comprehensive social safety net sounds like utopia, but the proposal would threaten the U.S. economy and national security, according to Robert Atkinson, president of the Information Technology and Innovation Foundation.

When a nation’s population is stable, economic growth depends on increased worker productivity. Productivity gains typically come from improved technology; therefore, the government should encourage automation, Atkinson wrote this month in calling for more substantial tax credits.

On HoustonChronicle.com: To keep ahead of the machines, human workers need better training

Technological innovation is especially important as China spends enormous sums on developing artificial intelligence to dominate the global economy. Now is not the time to discourage research and development, Atkinson argues.

The robot dilemma facing our nation - arguably the world - is complex. Americans frustrated by machines replacing them have shown their anger at the ballot box. They want politicians to protect their jobs and guarantee an opportunity for the American Dream.

The march of technological advancement, though, is unstoppable and fickle. During the 20th century, the U.S. led the world in innovation, but the wrong policies could divert that magic elsewhere.

Our government’s first responsibility is to its people, but in this case, we need to find an as-yet-unknown middle ground that doesn’t advantage machines over people.