In some places, not selling to police is illegal discrimination.
For example, in California it is a violation of the Unruh Civil Rights Act. See Long v. Valentino (1989). http://www.lawlink.com/research/caselevel3/66962 . A police offer attended a public ACLU meeting. Once the ACLU organizers discovered that this was the case, they told the officer to leave. The trial established that this was illegal discrimination under Unruh.
> And defendants' attorneys correctly agreed at oral argument that an announcement such as "You can't eat in my diner because you are a lawyer, bricklayer, female, or Indian chief" would be actionable under the Unruh Act, although words alone were the means employed to effect unlawful discrimination. (See Koire v. Metro Car Wash (1985) 40 Cal.3d 24, 35-36 [219 Cal.Rptr. 133, 707 P.2d 195]; Marina Point, Ltd. v. Wolfson (1982) 30 Cal.3d 721, 726 [180 Cal.Rptr. 496, 640 P.2d 115, 30 A.L.R.4th 1161].) Nevertheless, defendants do urge an exception for on duty police officers, a proposition we consider in the following section.
...
> At the same time, however, police officers are literally on duty 24 hours a day under California law. (See People v. Corey (1978) 21 Cal.3d 738, 746 [147 Cal.Rptr. 639, 581 P.2d 644]; People v. Derby (1960) 177 Cal.App.2d 626, 631 [2 Cal.Rptr. 401]; Pen. Code, ?? 142, 830.1.) And they are as much entitled to the protections of the Unruh Act as any other citizen. They may not be refused service in a restaurant, denied an apartment, or ejected from a public meeting merely because of their occupation, whether working a shift or on vacation. We find defendants' position on this point, at least as articulated at oral argument, to be as reprehensible as the police abuses decried above. Police officers as individuals have rights, too, and can bring actions for violations of those rights even though their injury has arisen in some way related to the performance of their duties. (City of Long Beach v. Bozek (1982) 31 Cal.3d 527, 538, fn. 9 [183 Cal.Rptr. 86, 645 P.2d 137].)
> A somewhat different problem is presented by the contention that a police officer on a mission to spy on individuals and organizations holding a public meeting may be excluded, however. We agree that is not quite the same as refusing to serve a beat cop a cup of coffee because the owner does not like police. ...
BTW, compare your "Don't talk to them at all when they are off duty." to the above mention that they are "literally on duty 24 hours a day".