Stupid and disrespectful, yes; illegal, no. It's called freedom of speech. Also, police are authorized to enforce the law in the entire state, not just the local jurisdiction. Of course this cop was not enforcing the law. He was engaged in a private vendetta.