The core activity - people exchanging sex for cash - is legal, but a bunch of other stuff around the activity is illegal.