Prisoners do talk to each other about past crimes or whatever they have been up to before going to jail. It's about survival in prison people live on their wits, how many times have you heard about cell mates confessing to other cell mates and then police getting involved, at one time they used to put prisoners in cells with other prisoners hoping to get confessions? I would not be surprised if this is not still carried on? Reasons prisoners confess They might figure that since they're both criminals, the guy won't snitch on him, or that even if he does, his testimony will be regarded as unreliable. Sometimes people feel like they want to tell their stories to someone, and in that situation there's no one else to confide in besides other prisoners. Also, sometimes people get to know their celly pretty well, and they may think that the guy is trustworthy. Also, if the celly does snitch, he'll be in violation of the anti-snitching convict code.
Confessors might not realize that there are plenty of people in jails and prisons who are yearning for any opportunity to get some information they can trade to the government for a lighter sentence, and the government is often happy to make that kind of deal, and to protect the snitches from retaliation. They also might not realize that some cellies will have an attitude of, "I'm going to go to prison for my crime, so you should too." If their celly treats them cordially, they might overestimate the strength of the bond of friendship between them.