I think the difference is in the purpose of the animal and not really the animal itself. For instance, when I think of livestock I think of something that is kept for a specific purpose such as food or because it has a job to do (i.e. a herding dog). The animal crosses the line into being a pet when it is mainly a companion and would be kept regardless of whether it produced or did anything at all.
This is the reason why animals such as a pot belly pig or a chicken can be either one depending on who is keeping it.
This is the reason why animals such as a pot belly pig or a chicken can be either one depending on who is keeping it.