I imagine the obviously humorous intent would be what would make what MM posted acceptable, while the hostility in the example you gave would not be. To that end, there's certainly an argument to be made in favor of race-related jokes being one of many tools to break down inter-racial division. Are we better off pretending that differences don't exist, or accepting and acknowledging our differences via light-hearted ribbing?
In my mind, race-based comments become problematic not because of their content so much as their reception. I work with a Spaniard, a Mexican and a Vietnamese woman, and we all joke about our ethnic and cultural differences (mine [or my lack thereof] included), and it works because we all understand that there is no ill intent, and it's all based in camaraderie. If any of us chose to take any comments personally, then we'd be an HR nightmare; the mutual understanding and respect is what makes our interactions OK.