I think what makes someone get away with a joke that rides that line is the spirit of the joke, who the joke is really about, and mostly, the heart of what transcends beyond the words. If some frat boy says a joke about a race or sexual identity that is not his own it’s going to be received differently than someone who’s heart and position is clearly on—let’s say—the right side of history.
But comedy isn’t timeless. It has to change with the times. There’s stuff in my old special Jesus is Magic that makes me cringe in the context of today, that doesn’t say the same things or would have a different inference in this time of our current epidemic of white cops killing black teenagers, for instance. You know? That’s what makes it art, dare I say. Simply that, what it is and what it means depends on whose eyes it’s being seen through, in the context of their experience and the context of the time in history it’s being seen.”