Spanking, whether hard or not, will only have one consequence: the cat will learn to avoid you. Cats have not a mind that can connect things like "I did bite" therefore "I am spanked". (I am convinced it is the same with children BTW).

On one hand most cats come and ask for being petted. Most of them don't like to be petted when they didn't start it

Some cats get very excited when petted (especially the belly) and if it is too much, they bite. Most of them will give you a sign however -like waving the tail.

Some cats also love to give you tender "love bites". I enjoy them

What are the situations in which your cat bites? It's difficult to tell in general.