Many 40+ year olds have families or other life obligations outside of work, and thus they may not be as willing to put in absurd hours that a young employee could be squeezed for. The older employee also might be more likely to take weekends off, and want to use vacation time.
Additionally, someone over 40 is supposed to be in or near their peak earning years, which lasts ten to twenty more years (or did historically anyway) so their expenditure is going to be significantly more than someone with a few years of experience.
I realize it's one of the lamest analogies possible, but for many companies, employees are quite literally a cog in a larger machine, and so they want the cheapest possible cog at a reasonable quality level that works the longest before breaking down (quitting, getting fired, burning out, etc).
To fight this, I'd bet those over 40 would have to aim to get into important management and executive positions, which are less likely to be swapped out for less experienced, less demanding, and cheaper labor.