At first (up until Chapter 6) Huck is willing to put up with the beatings because he enjoys the lifestyle of living at the shanty with his father.
In that chapter, he talks about how free it feels to be away from the Widow Douglas's home and away from school and all the rules of society.
It was kind of lazy and jolly, laying off comfortable all day, smoking and fishing, and no books nor study. Two months or more run along, and my clothes got to be all rags and dirt, and I didn't see how I'd ever got to like it so well at the widow's, where you had to wash, and eat on a plate, and comb up, and go to bed and get up regular, and be forever bothering over a book, and have old Miss Watson pecking at you all the time. I didn't want to go back no more. I had stopped cussing, because the widow didn't like it; but now I took to it again because pap hadn't no objections. It was pretty good times up in the woods there, take it all around.
This reflects on the theme of Huck's attitude towards society and its values. Society would say that Huck is getting what he needs at the Widow's. Being there and going to school is good for him. But he doesn't like that and so he is willing to endure abuse to be able to do his own thing. This shows how dedicated he is to the idea of being his own person.