There are of course other reasons that it will do this such as when it is a kitten and noticing it is telling the mother cat everything. In most cases the mother cat will also back up again and let them know they are safe and out of danger. Most kittens can purr when they were only two days old and this helps them to communicate with their mother.
There are other reasons that cats purr and in the wild it is very common that a cat will purr when they are injured. This lets other cats know that they are in distress and they need help. A cat will let you know when they are happy and when they are not because they have a lot of emotion. If you for example accidentally put your cat's tail they usually will snap at you at this let you know they are not happy. When you bet your cat and a beginning her this is a sign they are communicating with you and letting you know they enjoy what you're doing to them.
Remember that it is very common for cats to put her and this is a way they can communicate with you and other animals. The basic reason for preferring is to let people know they are content and happy. Kittens also will purr when they are nursing because they are communicating with their mother that they are getting a proper nutrition. it is also very common that the mother cat will purr back at the kitten to let them know everything is okay and there is no danger.