Several readers made this connection:
I remember when I was a kid back in the late '50s going to the men's room at the neighborhood Sunoco station where they had $.25 condom vending machine that had a sign in bold letters "SOLD FOR THE PREVENTION OF DISEASE ONLY".
So they're not illegal, but condoms can be used as evidence of prostitution – in court and as a basis for arrest. This means that sex workers are sometimes afraid to carry enough condoms, putting themselves and their clients at risk. I know this is a problem at least in New York, North Carolina, and San Francisco and I assume there are other places with similar legal issues. Here's an article from the Atlantic about it.
Earlier post here.