I've discussed laws governing prostitution with three different Mexican attorneys. One held a position equivalent to a U.S. District Attorney. This is what they say:
State and local laws--not Mexican federal law-- governs prostitution. So the law varies according to the jurisdiction.
In Tijuana, prostitution per se is legal. However, public manifestation of prostitution--meaning things like solicitation on a street corner--are illegal (but permitted in a Zone of Tolerance such as the Zona Norte.) Living off the earnings of a prostitute--by doing things like operating a brothel--are illegal.
Working without a health card is a violation of the administrative code, not the criminal code. A man cannot get into legal trouble if his prostitute lacks a valid health card. It's sort of like buying a taco from an unlicensed street cart. The vendor is breaking the law, but not the customer. (You need a license to sell tacos, but not to buy them. Same deal with prostitution.)