Why does Huckleberry Finn risk punishment for helping Jim escape?
Huckleberry Finn was born and has grown up in a slave culture. The overwhelming majority of the people in that culture believe that it is right and normal for white people to own black people as slaves, and that slaves are the property of the people who pay for the slaves. Jim, therefore, is Miss Watson's property. As property, an escaped slave is to be returned to his or her rightful owner. Any white person who does not actively attempt to return a person's property has, in essence, broken the law. It was often said that such a person would go straight to hell for not helping the slave owner recover his/her property in a timely manner.
Because of Huck's new friendship with Jim, Huck is facing a moral dilemma. Huck has spent much time with Jim and has come to know him as a thinking, feeling, hoping, dreaming individual--not just Miss Watson's property. As a friend, Huck wants Jim to achieve all those dreams and goals they talked about while floating down the river on their raft. As a member of this slave culture, Huck knows it is his responsibility to let Miss Watson know where her property is or risk punishment for breaking the law on earth as well as spending eternity in hell. Huck decides he will just be punished since his friendship is more important to him, and also since Huck has never been much of a rule follower anyway.
So, Huck not only agrees to help Jim get to Cairo (which they miss in the dark of night and float on farther down the Mississippi), but he also arranges to help Jim escape after the Duke and the King turn Jim in for the monetary reward. Tom Sawyer is in on this, but he already knows that Miss Watson has given Jim his freedom. This points to Tom as a cruel individual and Huck as a compassionate law-breaker who has risen up against society twice for the friendship of an escaped slave.