some places don't allow tipping, especially when the workers make a full wage (so basically anyone except restaurant servers). i worked at a coffee place where we explicitly weren't permitted to accept tips per company policy, so if someone asked me to keep the change i had to tell them i can't and give their money back. that may have been what happened to you.
United States