1st amendment says otherwise.
Antagonizing a cop just to be a dick will probably result in those minor charges he would have ignored if you were nice, getting written up with a smile on his face. That's 100% your fault in that case.
That it may be difficult for a court to unambiguously distinguish this abuse of power from legitimate application of discretion doesn't mean that it is legitimate.