Software (yes, I know, with some exceptions) can mostly be written anywhere.
If that were true, then how come there is a need for H1Bs? Why not just outsource the work?
No, there must be some value loss from outsourcing, otherwise they wouldn't need to bring people into the US and have exiting workers here train them.
The cynical part of me keeps coming back to an after-hours conversation with someone who used to work in my former employer's HR department. They'd mention how much flak companies get by using outsourced employees and the backlash of "costing American jobs". Using H1-B visas to acquire employees, you can still say that you haven't sent jobs overseas and that you're keeping jobs "home, where they belong". Add mandatory Stars and Stripes lapel pins and you get something that people can advertise for you and bring in Made In America money. Even better, they don't have to pay as much for H-1B employees as they do for locally-hired staff and, when those staff start asking about becoming long-term employees, the employer can end their contract, bring someone newer to replace them, and show a nice drop in costs for their quarterly department meetings. It's one of the reasons why H-1B quotas fill so quickly in certain sectors. It was intended to fill short-term gaps or when a specific set of skills can't be filled normally. Realistically, it's clear they're not all being used as intended.