I probably got told by police officers to put a leash on him around four or five times (total!), but I was never ticketed, not even once, though it was always against the law.
Every once in a while, someone having a bad day would yell at me: Your dog needs a leash! and my favorite response was: Your face needs a muzzle! But I always carried a leash when he was with me, despite not intending to use it, and I eventually stopped antagonizing strangers like that, since the risks were too high – and I should stress that the overwhelming majority of comments were positive.