The one who learns by reading.
The few who learn by observation.
The rest of them have to pee on the electric fence for themselves."
Will Rogers
The art of storytelling has been linked to teaching from the beginning. The oldest fairy tales are not fun entertainment but rather gruesome cautionary tales; beware of strangers, don't blindly accept gifts, there are dangers out in the world at night, being clever is critical to survival. A wise author will tap into this. It doesn't necessarily have to be a moral but a good book should teach something. Or should inspire the reader to go out and learn something.
"To Build a Fire" a famous short by Jack London is a perfect example of this.