Cats form complex bonds with people as well as other cats, but cats aren’t people. Cats don’t speak English, and most people don’t speak ‘cat’. Purring is an indication of in-moment contentment and cats, like people, can quickly change their minds. It’s therefore important that you stay focused and pay attention to these changes in your cat’s demeanor as otherwise your cat may just haul off and bite you!
When a cat bites you during a purring-and-petting session, seemingly out of nowhere and for no apparent reason, it’s usually because the cat has been saying (in cat language), “Enough with all the petting already!” but you haven’t been listening. This is often described as ‘over-stimulation’. Afterward, the cat will usually leap off your lap and run away.
Perhaps the cat is overstimulated. Or, perhaps cats don’t like being petted after they’ve had enough any more than people like being hugged to the point where it gets awkward. Cat society has its own rules of propriety and learning to ‘read’ a cat can take quite a long time.
Their ways are not our ways. Don’t punish your cat when it nips at you during a petting session. The way the cat sees it, you are the transgressor, not the cat.