If there is a difference in value, then it isn't illegal to choose the superior candidate. I described characteristics which can be legally used in making a hiring decisions, because they affect value offered for the position. These characteristics tend to on average make younger employees more desirable for typical software engineering positions, all other things equal (like perceived programming skill).
For any individual case, where 25 year old Alice and 45 year old Steve have similar perceived programming value but Alice will (a.) work for less and (b.) seems like a better cultural fit, do you think Steve is entitled to the job? What if they are completely identical from a value and cost perspective, 'cultural fit' aside -- is Steve entitled to the job? Unless you can prove Steve was superior for the job and lost it anyway, which is highly arbitrary, there is no recourse for legal action. Which is why I think private discrimination laws are ridiculous, because they are effectively unenforceable. Most prejudiced employers will not print out a rejection letter stating the exact prejudice that led to the decision.
Laws are not the "word of God", and just because there is a law, it doesn't mean you stop discussing it.
EDIT: Quotes around "word of God," because it was apparently taken literally.