The statement of "boys will be boys" refers to the type of mischief and foolishness that is often associated with young boys as they mature. Certainly, this applies to Tom Sawyer. Tom is a character that enjoys being free enough to be what he wants to be. Sometimes, this means finding himself in mischievous situations. Playing practical jokes on people, as he does to get his friends to whitewash his aunt's fence, would be one such example of Tom acting in the way of "boys being boys." Spying on his own funeral is another such example of Tom acting in the manner of "boys being boys" in that he enjoys constructing situations that others would deem as "troublesome," but that he sees as simplistic fun. His love of being a pirate or a robber, a life where there is excitement, is another example of Tom acting in the way of "boys being boys."
There is something innocent and pure in how Tom wishes to break away from "civilized" society, something he sees as constricting and phony. In Tom demonstrating "boys will be boys," there is a purity of heart and innocence that makes him endearing. This sense of hope and optimism is something that Twain envisioned for America, as it was coming of age, just as Tom in the novel.