Discrimination in Housing is Allowed
The federal laws regarding housing in the USA make it so that one cannot discriminate on the basis of color, race, gender, religion, disability or familial status. These are spelled out in section 3604(c) of the Federal Fair Housing Act. This law generally prohibits stating, in any notice or ad for the sale or rental of a dwelling, a discriminatory preference. Many states prohibit discrimination based on other factors (e.g. sexual orientation, age, marital status, or source of income).
One loophole is when a homeowner decides to rent out a room or two. In this case, advertising which expresses a preference based upon sex is allowed in shared living situations where tenants will share a bathroom, kitchen, or other common area. Federal Fair Housing laws do not cover the basis of decisions made by landowners who own less than four homes, and live in one of the homes. It is legal for the owner to discriminate in the selection process based on the categories noted. Thus, many advertise a shared housing unit, in which tenants will be sharing a bathroom, kitchen, or other common area, and express a preference based upon sex only (i.e., Females are preferred!)
Most of the protected categories pertain to the selling or buying of a home, not shared rentals as described above. The key element that most homeowners who do rent out a room or two, have fewer than four homes and most share common areas, like, bathrooms, kitchens. But, what about a room that has a bathroom? Since the kitchen is still part of the common area, the owner could discriminate. The law remains unclear about if in the room ad, an owner can use language that is clearly discriminating- like, "Prefer women" or "Prefer men" or "No children allowed". That is because the owner is sharing their home. Even if the ad does not mention this, the owner can discriminate based on nearly any of the protected classes without being overt about it. Just as an hiring manager can do so with any job applicant.
Of course, apartment complexes cannot discriminate in any of the categories or face fines from HUD when reported. But, shared rooms in a house is a completely different matter and it does make sense. The home is your "castle" and the owner should be able to discriminate who shares it with others. So, if you are looking to rent a room, if the ad states a gender preference, just continue looking if you are not the "preferred" type!