I wonder because:
(1) Prostitution, also known as paying for sex, is generally illegal.
(2) Adult film stars sign contracts to be in movies where they have sex. Thus, they are payed to have sex.
How do the makers of these types of movies avoid that kind of legal trouble?