I think the biggest thing that I haven't seen in another comment is that companies aren't being explicitly ageist, they just want cheaper labor and younger/less experienced people are willing to work for less money. I'm sure plenty of companies would be more than happy if you said "I have decades of experience but I'll take the salary of a junior position". Without something similar to a union or a change in laws to…
Of course the assumption is that they have to pay more for more experience.
But it's also about perceived power and control. Younger workers are seen as more compliant, and many managers do not feel comfortable hiring underlings who are older.