Huck regrets his behavior and feels rather low about how he treated Jim. In the early episodes of the novel, Huck often plays tricks on Jim and acts childishly. He does not consider Jim's feelings or Jim's response to being treated in this way until Jim finally chastises Huck.
Here, when Huck plays a mean trick on Jim, Jim fully expresses his feelings in one of the longest monologues of the novel:
"...I's so thankful. En all you wuz thinkin' 'bout wuz how you could make a fool uv ole Jim wid a lie. Dat truck dah is trash, en trash is what people is dat puts dirt on de head er dey fren's en makes 'em ashamed." (excerpt)
Huck is humbled by this speech. He works himself up to apologize to Jim and decides then and there to change his behavior.
"...I didn't do him no more mean tricks, and I wouldn't done that one if I'd 'a' knowed it would make him feel that way."
This change in Huck is part of his growth and characteristic of his burgeoning maturity. Learning to recognize and respect the feelings of others is a large part of Huck's development in the novel. With Jim, the Wilks family, and the Phelps family, Huck is tasked with coming to terms with the idea that his interests sometimes must be subordinated to the interests of others. What is good for him might harm someone else.
This moral knowledge distinguishes Huck from Tom Sawyer when Tom appears in the final third of the novel. Huck's growth becomes clear in contrast to Tom's selfish antics.