The Federal Housing Act listed a lot of actions that were not permitted, but it permitted one type of specific age discrimination. (MORE)
The permitted discrimination is for communities in which at least one member of the occupying household is at least 55. The key word is "occupying." Those without an occupant who is 55+ can buy but not occupy.
I am frequently asked: "I am the oldest in my household but am only 53. May I (we) buy, rent it to an age-qualified household for 2 years and then move in? The answer is "Yes, let me represent you in purchasing. If you wish, I can recommend a property manager."
These 55+ communities are often called "Active-Adult Communities" though no adult living there need show he/she was active or intended to be so. It appears that developers of this product defined what 55+ communities should offer to buyers and provided facilities designed to keep the residents active physically and mentally.