Read this article from digboston: Sex, Consent and Custody. Massachusetts and 35 other states do not explicitly forbid law police officers from having sex while on duty. Individual departments may have policies forbidding on-duty sexual intercourse, but the lack of a state law creates a loophole that officers may use to claim that people in their custody consented to have sex. The article describes several instances of officers trying to use this loophole to get away with rape.
Unlike police officers, Massachusetts prison guards and other correctional officers are forbidden to have sex with people in their custody. State senators are in the process of drafting legislation to prohibit police from having sex with people in their custody or other people they interact with in the course of their duties. We support this legislation.