Things like that are fine. Impersonal polite interaction is ok.
However, never, ever say "It must be free" when something doesn't scan right away. I promise any cashier someone says that too is thinking about punching them. If the person then adds "Come on, thats funny, why aren't you laughing" the cashier is trying…