The idea usually is that the presence of an H1B means that someone local does not exist to do the job, which means that a company would otherwise have to pay more than the going rate to poach someone else from another company. Then the company losing the employee has to pay more to poach from somewhere else, and so on, until eventually everyone who is suitable for such a position is making more.
The fact that H1Bs are paid what the locals are paid is exactly the issue people have when they talk about wage suppression. It is in much the same vein as when Apple/Google/et al. agreed to not steal each others employees. It is not like those employees were exactly hurting for compensation, but they theoretically could have made more without that treaty between companies.