Not all criminals are made equal, as is observed by how separated the prison population is. With the strict rules and many types of crimes that can put people in the slammer, it is not surprising prison has a diverse population of inmates. Despite the seemingly chaotic nature of these criminals, many of them actually have their own codes on how to behave.
Inmates are people too, and there is reasoning behind their actions, unless they are completely insane psychopaths. Key word is insane. For example, most inmates do not like individuals incarcerated for crimes against children. That is universally a huge no-no in the prisons in the United States.