One: "Nigger" was used this way long before rap. Exhibit A: Claude Brown's biographical account of growing up in Harlem in the 1940s and 1950s, Manchild in the Promised Land. Here is someone warmly counseling Brown in the fifties:
You're one of these complacent niggers out here who managed to get by and not have it bother them directly...when the shit comes down on you, you're going to be one of the angriest niggers out here on this street, man...you see all these niggers running out here talking about they want some white girl. Damn, I don't want me nothin' but a nigger woman.
Examples like these are hardly rare. And furthermore:
Two: "Nigger" wasn't the first slur against blacks that shifted from slur to term of affection. "Coon" began as a comparison of blacks to raccoons for reasons of coloring, and today it is thought of as a nasty, albeit rather archaic, equivalent to "jungle bunny" or the like.
However, one hair out of place has always been that black songwriters a century ago so regularly used the term in their own work. Ernest Hogan had a mega-hit with "All Coons Look Alike to Me." Scott Joplin put words to one of his rags and referred to "coons" as if he were a white writer.
They were knuckling under to the conventions of the era in the only way they could achieve financial success just after Plessy v. Ferguson? A reasonable explanation, but it frays when even someone as tripwire-sensitive to condescension as composer, conductor and world-class violinist Will Marion Cook was also casually stuck coon into his lyrics.
Could it be that "coon" was transmogrified into a term of affection by gaslight-era blacks just as "nigger" would be decades later? One hint that it was is an old-time expression among blacks, that a friend was "my ace boon coon." But to learn more, today there is no one living to fill us in.
However, my friend and ragtime historian extraordinaire Edward Berlin dug up smoking-gun evidence leafing through ancient numbers of the Indianapolis black newspaper the Freeman. Sylvester Russell, the main drama critic, knew his racism quite well, deplored it, and staged a sit-in sixty years before they became common. He had no use for "nigger." Yet he casually noted in 1904 that "The Negro race has no objections to the word "coon."
To be sure, the word elicited controversy just as "nigger" does now. The following year Russell interviewed black stage composer superstar Bob Cole. Cole, dedicated to showing whites blacks' dignity by doing his vaudeville act in black tie and writing gem-like "genteel" songs (the one with any resonance today is "Under the Bamboo Tree"), said "The word 'coon' is very insinuating and must soon be eliminated." But then, Cole had no problem with, of all things, "darkey"!
Three: It is a human universal to transform slurs in this way. Quite commonly, people use a disparaging term joshingly as an in-group equalizer. In Russian, "muzhik" means "peasant" and has also come to mean "good guy." Recall the businessmen George Costanza runs in with in a "Seinfeld" episode who use "bastard" as a term of affection. South Sea Islanders have made the initially insulting "kanaka" into a term of ethnic pride.
And we can give the last word to an Italian restaurateur in the twenties described by Michael Lerner in his new Dry Manhattan on the follies of Prohibition in New York, who in court hollered "Every wop around here is selling drinks, why can't I?"