it does happen sometimes, you read about guards getting caught up in things with the inmates. once the affair is exposed, the offending guard is prosecuted and charged with a felony. Their punishment: the inmate gets a few months in the SHU but the prison guard ends up an inmate in prison themselves.