Cf. Freud, Wit and It's Relation to the Unconscious. "The libido of looking and touching is found in every person in two forms, active and passive, or masculine and feminine."
Needless to say this theme is elaborated, e.g. "Among rural people or in the ordinary hostelry one can observe that not till the waitress or hostess approaches the guests does the obscene wit come out; in a higher order of society just the opposite happens, here the presence of a woman puts an end to smutty talk."
I highly recommend this work.