I know it happens, but not 100% why. Probably depends on the species, I believe that it's usually stress related unless of course we're talking kingsnakes which just eat snakes naturally. Here's an older post on the subject. The scent of food on them would probably contribute too, I imagine, but I'm really not sure.