In addition to being a sign of contentment, it is a signal, a homing call that cats learn early.
At first, they feel only the vibrations of a purr when their mother cat uses it to bring them to feed.
Later, cats learn to use it to indicate fear and distress as well as pleasure.