Don't confuse the combination of opportunism and access with homosexual desire. Homosexual sex in prisons is, overwhelmingly, driven by the combination of lack of the opposite sex and the male sexual drive... not innate desire that manifests with the exercise of free will.
Many explanations for this rather rare phenomenon are a lot more plausible than yours.
1. Some aren't really homosexual. Their sexuality, as defined by the Kinsey scale, would be closer to heterosexual than homosexual.
2. Some still have homosexual desires, and make arrangements (honest and otherwise) to have their cake and eat it too, so to speak.