They only say that if you have a bounty, and you can sometimes get a bounty without having the guards try to chase you down (very minor offenses or otherwise offenses that happen with a witness but not close enough to a guard to respond).
They'll recognize you as being wanted for a crime, and you can have the option to bribe them into ignoring you. If you get involved with the Thieves Guild, you can eventually make it possible to be able to pay off your bounty and clear your record with a guard.
You don't have to actually answer them, though. They'll say it at random in passing and you can just keep right on walking. It's only once you fully engage them in conversation that you're stuck with either paying the fine or else all of the guards will become hostile.