The meaning of the word has changed not a bit. At the time it was a colloquialiasm for a person with black skin. It still means exactly that.
When Twain wrote HF the word did not have the “ultimate insult” connotation it does today. It was at most mildly denigrating rather than something used to more or less justify any reaction up to and including murder. You can’t tell me the meaning and connotations of the word haven’t changed.
If they haven’t, why are you yourself so carefully avoiding typing it?