The party buried ALL of the treasure after they searched the cave. This was later dug up by Gandalf and Bilbo on their return. Gandalf took most of it to be used for various good works, and Bilbo took the rest (several bags worth).
"Then they brought up their ponies, and carried away the pots of gold, and buried them very secretly not far from the track by the river, putting a great many spells over them, just in case they ever had the-chance to come back and recover them. When that was done, they all mounted once more, and jogged along again on the path towards the East."
Then later
Not far from the road they found the gold of the trolls, which they had buried, still hidden and untouched. I have enough to last me my time, said Bilbo, when they had dug it up. You had better take this, Gandalf. I daresay you can find a use for it. Indeed I can! said the wizard. But share and share alike! You may find you have more needs than you expect. So they put the gold in bags and slung them on the ponies, who were not at all pleased about it.
In LOTR, a bit more is added
And in the middle of it all Mr. Bilbo comes up the Hill with a pony and some mighty big bags and a couple of chests. I don’t doubt they were mostly full of treasure he had picked up in foreign parts, where there be mountains of gold, they say; but there wasn’t enough to fill tunnels.