Yeah, that one drives me nuts. Law Enforcement officers can and will lie to you in an investigation. They are given broad discretion by courts to so, especially in the sort of "sting" operations that are common in prostitution enforcement. But the whole "they have to tell the truth if you ask if they are a cop" is absurd for several very god reasons, but people persist in believing it and repeating it as true. Now, asking if the other party is a cop is of use in a face to face interaction as a perceptive person can sometimes detect deception through body language, inflection, etc. But asking it via text is a pointless waste of time. Finally, the "are you a cop?" question can bite you on the butt in court. It's unlikely to be used as an argument by a prosecutor, but many jurors are going to ask themselves. "So why did the defendant ask that? Why would he have concern if the girl was a cop? What is he afraid of?".
Its human nature I suppose. There are always people who are going to believe in things that are transparently not true, and/or a bit nutty. See Flat Earth Theorists and Sovereign Citizens.
On the other hand the " show me yours and ill show you mine" is probably a better test. You know the whole " I need you to reach over and touch my boob and I'm going to touch your crotch." Sort of thing. I've never heard of an undercover or sting "bait" girl doing that. But I may very well be wrong? Anyone have any insight on that?
One quick amusing anecdote in regards to the "are you a cop?" question. Back around 2001 I had a street walker approach me and strike up a conversation. At one point she asked me "Honey are you a cop?". Being youngish and naive on the subject I thought I was being funny and replied " Why? Do I look like a cop too you?". She looked at me for a moment and said "Well, now that you mention it, you do!". At the time I was six foot tall, with a large frame and was in reasonably good shape.. I was clean shaven and wore my hair in a severe " buzz cut". Woops!