This form of discrimination is illegal. Do you think Facebook is above the law? The pricing structure does not change the applicability of anti-discrimination laws.
I don't think discriminating during hiring is legal, or should be legal.
All I was saying that delivering hiring ads based on a certain demographic, that will bring you the most potential candidates, is a financially sound decision, as long as the hiring process as a whole is non-discriminating.
What if this bias in who the ad is displayed to algorithmically determined. If only users >40 click on the ads, and then the ad system stops showing the ad to users <40, is that illegal?
e: I should have clarified the type of advertisement.