It's pretty common, even in folk tales. It teaches temperance and all that stuff. It's also an easy way to show readers that your protagonist is morally superior for refusing some temptation that would ensnare most.
Because of that, putting it randomly in your story won't do any good. It's best...