Or in the UK train drivers ;-)
Sure, the companies tried the standard approach of just secretly agreeing not to compete with each other for talent, but the DoJ didn't care for that, and so they just do the other thing: pay as much money as is necessary to get the folks they want.
Apple makes about $435,000 in profit (not revenue) per employee, including non-technical employees. If they think that they need to pay staggering salaries to programmers to keep a good thing going, they will absolutely do it. Would they like to pay their programmers a third of what they're paying now? Totally. Would such a salary be fair? Totally. But those programmers would just call a Google or Facebook recruiter and be out the door the next day.
There is a reason why software is %20 of the economy and most economic growth in the USA now and why engineers are paid a lot and I believe they are correlated.
I always wondered why the FAANG companies don't move their main campuses to somewhere with a lower CoL (call it CoL') so they only need to pay $(CoL' + X' + Y) to keep the employee. Paying X' (where X' probably less than X) because they're no longer in local competition with the other companies. I wonder how long it would take to recoup the cost of moving the company in savings on compensation. There are countless places which have better quality of life than the Bay Area, while also having lower CoL. I chose to move to the Bay Area because Y was greater than what I could get anywhere else.