When a child tells the truth, even though he knows that it will result in negative consequences, he is inhibiting the impulse to lie to avoid unpleasantness. When he shows charity to others, he is inhibiting the impulse to behave selfishly. Without a majority of such citizens, storekeepers would have to post armed guards in front of every display counter, women would live in constant fear of being raped by roaming bands of marauding men, and children would be left to the mercy of those who would exploit them. Unfortunately, poorly socialized children generally do not. Herein lies the awesome responsibility of parenting.
Parents socialize children through two mechanisms.
The first is teaching through direct instruction reinforced by a combination of rewards and punishments for acceptable and unacceptable behavior. The second is teaching by example. Of the two, the latter is the more important mechanism since most complex human behavior is acquired through observational learning. Children are much more likely to do as a parent does than as a parent says. This is why parents who lie and cheat tend to raise children who lie and cheat, despite any direct instruction to the contrary.