My mom went through the same thing when she was the boss and kept candy. It got to be kind of a joke between us, when we went to the store and loaded up on bags of candy for the "whiny little babies" she worked with. But she was willing to put up with the whining in her case.
There's a line between thinking something is a treat, and thinking it's something you deserve; and when someone crosses that, it's not fun to provide the treat anymore. It makes me think of other favors, like giving someone a ride, that become expected over time. Several years ago I had the habit of offering a certain co-worker a ride about once a week, never planned, always spontaneous. Then one day she said, "Yeah, it's raining and I left my umbrella at home, because I figured you could give me a ride today." I immediately said, "Oh sorry, I can't today." It wasn't that she was terribly rude, it just started to peek over that line, between me doing something nice voluntarily, and me feeling like I was obligated to do something.
If I were the candy jar person, I think I would just take it home for a while. Kind of take a candy jar breather. Maybe in a few weeks/months, whenever the whining died down, I would bring it back for a while, but always remove it whenever someone got a little too egregious. Remind them that it is a privilege, not a right.