But the migration of Japanese auto manufacturing to the United States over the last 30 years offers a case study in how the unlikeliest of transformations can unfold. Despite the decline of American car companies, the United States today remains one of the top auto manufacturers and employers in the world. Japanese and other foreign companies account for more than 40 percent of cars built in the United States, employing about 95,000 people directly and hundreds of thousands more among parts suppliers.

The United States gained these jobs through a combination of public and Congressional pressure on Japan, “voluntary” quotas on car exports from Japan and incentives like tax breaks that encouraged Japanese automakers to build factories in America. Pressuring technology companies to move manufacturing here would pose different challenges. For one thing, Apple and many other technology giants are American, not foreign, and so are viewed differently by politicians and the public. But it is possible and the benefits might be worth it, some economists say.

“The U.S. has a long history of demanding that companies build here if they want to sell here, because it jump-starts industries,” said Clyde V. Prestowitz Jr., a senior trade official in the Reagan administration who helped negotiate with Japan in the 1980s. The government could also encourage domestic production of technologies, including display manufacturing and advanced semiconductor fabrication, that would nurture new industries. “Instead, we let those jobs go to Asia, and then the supply chains follow, and then R&D follows, and soon it makes sense to build everything overseas,” he said. “If Apple or Congress wanted to make the valuable parts of the iPhone in America, it wouldn’t be hard.”

One country has recently succeeded at forcing technology jobs to relocate. Last year, Brazilian politicians used subsidies and the threat of continued high tariffs on imports to persuade Foxconn — which makes smartphones and computers in Asia for dozens of technology companies — to start producing iPhones, iPads and other devices in a factory north of São Paulo. Today, the new plant has 1,000 workers, and could employ many more. Apple and Foxconn declined to comment about the specifics of their Brazilian manufacturing.

However, a developing country like Brazil can adopt trade policies that would be difficult for the United States to do. Taking a hard line to reduce imports of technology goods and encourage domestic manufacturing could violate international trade agreements and set off a trade confrontation. “We’re a long way from even talking about limits on imported iPhones or iPads,” said a former high-ranking Obama administration official who did not want to be named because he was not authorized to speak.