This is somewhat debatable from today's perspective. There are in fact institutions in the USA where reading Huckleberry Finn has been taken off the curriculum precisely because of this issue.
Probably the rationale is dominantly that they don't want to expose young readers to this language out of fear that they won't be able to discern how this was once acceptable but isn't now, but there is arguably also an element of genuinely censoring Mark Twain.
The English Wikipedia article on the word has a section about "Cultural use" of the word which is currently almost exclusively about this book.
Whether Twain, or his protagonist, were "innocently" using the word, or intending it to be demeaning, isn't really decidable. On one hand, that's how the word was used back then. On the other, it certainly was in some senses demeaning, because that was the dominant attitude towards black people in American society in those days.
As the book's story arc develops, Huck's attitude towards Jim becomes more warm and sympathetic, and it's not hard to imagine that bringing readers to the same conclusion was one of Twain's motives for writing the book.