It's origins are from the American South during the days of slavery. The phrase was first used by slaves to indicate abusive, manipulative or cruel behavior. When slave owners asked about the phrase, slaves would claim it referred to generosity. Because this was done consistently, slaves were able to use the phrase to openly insult their masters to their face without facing any consequences.
The true meaning of the phrase became widely known after the Civil War, as freed slaves began being open about what the phrase had meant all along.
The myth that it means anything good is perpetuated among the descendants of racists, largely because some white folks never gave a second thought to anything a black man said. As a result ,"That's mighty white of you" is used as a compliment mostly by people who are likely to refer to "Those uppity Negroes" in private.