I think a big reason for age discrimination is also the cost of health insurance.
One employer I worked for refused to provide it because he was cheap and greedy. Then he hit 40 and found out if he was in a group, HIS premiums would be less. He didn’t care that my policy would cost more than a marketplace policy. He screwed over all his employees so he could save a few bucks.
He also complained bitterly when minimum wage went up because it would cost the company an additional $400 a month.
He was making over $500k a year. He was one of the worst bosses I ever had for treating older workers, especially women bad. He once told me he could easily replace me for less than half my salary.
That was when I stopped giving a shit about his business and it started being reflected in the profits.