Eh, at the same time, IIRC the troll-cache is presented as an unalloyed benefit, even though it did pose a logistical challenge to retrieve. I don’t think Tolkien is trying to say “if you want treasure, you are evil” at all, though he’s definitely saying “some things are worth more than gold.”

There’s a pretty big difference between asking “hey, how much of this can I fit in my saddlebags?” and “hey Bill, want to murder Tony so we can keep his share?”