In Chapter 12, Huck explains his dad's philosophy that "borrowing" means taking something with the intention of paying the person back in the future. The widow, however, has told him that it's a soft sort of stealing. Jim replies that they're both partly right; he and Huck work out a plan to cut down on their borrowing. The items they give up are ones Huck doesn't like.
In Chapter 35, Tom is orchestrating the dramatic escape for Jim based on the adventure books Tom loves to read and reenact. (We see in this chapter how much Huck has matured though Tom has not. Huck still follows Tom's lead, however.) Tom decides they need a sheet for a rope, a shirt for a journal, and so on which Huck steals. He still calls this "borrowing" but Tom tells Huck it's stealing on behalf of prisoners. Tom's rationale is that "prisoners don't care how they get a thing so they get it, and nobody don't blame them for it, either. It ain't no crime in a prisoner to steal the thing he needs to get away with... it's his right" and that the boys have "a perfect right to steal anything on this place" needed for the escape. When Huck steals a watermelon, however, Tom objects because it wasn't needed for the escape and makes Huck pay for it.
The difference between these two chapters could be that Jim is actually serving as a mentor of sorts to Huck in terms of giving up stealing, if only gradually. Tom, on the other hand, has Huck stealing more significant objects for a purpose that only Tom really comprehends. This could signify Tom's general lack of humanity toward Jim as well. Tom is pulling Huck and Jim into harm's way as part of his childhood play. Tom views Jim like a prop or an extra in his production but Huck has grown to consider Jim a man, a human being, a friend, someone who has been there for him during their journey. Jim has helped Huck grow up and Tom is tempting Huck with a return to immaturity, callousness toward Jim, and general mayhem.