So during the age of piracy did anyone actually burry their loot or was that just a story? I'm not familiar with how banks worked back then, would pirates feasibly be able to use them? Also, how were they able to sell off the larger goods they stole like spices and shit?
There are a lot of parts to OP's question! So I'm going to break it down into two basic parts: first, what do we know about buried treasure in the early modern era. Second, what do we know about the pirate economy. (Much of the second part is from an earlier answer of mine.
So first: buried treasure!
The interesting thing is what "buried treasure" would have meant in pirate days, or at least, the 17th century I'm discussing here: magic. From the early medieval Islamic world into later medieval Europe, treasure hunting was a popular, regimented, academically discussed, and frequently magical activity.
In Augsburg (or more likely one of its "suburbs") in 1544, Regina Koch was accused of hunting for buried treasure she had been convinced was in her garden. A neighbor testified accordingly (in third person from the transcriber):
On Monday morning at 4 AM she saw the women that she didn't know come out of the shed. One of them had a book in her hands and read from it. Then the village priest also came and read from a book. The strange woman's servant made a circle with a drawn sword, in which the woman sprinkled water with a little aspergillum, just as if it were holy water, and afterward made four lines in the circle with a hoe.
From a friend, we learn a bit more:
His sister-in-law told him twenty years ago that there was treasure in this house where Koch now lives. SHe came to him last week with another woman, who was here for that reason, and asked if he would help them dig for it, and if he knew anyone else who would also help. He said he would help dig, and that he has a good friend who would also help. So they went to Koch's house and started digging...
...He and those who were digging with him first said an Our Father, a Confession of Faith, and some psalms...The priest was there at the digging. He had a censer with glowing coals and spread smoke, and occasionally read from a little book.
But treasure hunting wasn't just for the hoi palloi--elite scholars got into the act, reinscribing treasure hunting as astrological. Al-Kindi, this awesome 9th century Baghdad mathematician, wrote multiple treasure-hunting manuals that ended up translated into Latin in the later Middle Ages. The steps for confirming a treasure exists, locating the treasure, and knowing how deep it is all involve calculations regarding the position of various planets in the ascendant sign and the status of the moon.
What makes the 17th-185h century so interesting in terms of buried treasure is the role of magic in mainstream (not folk culture) European minds. It was really when writers in significant numbers start being skeptical of the idea of witchcraft at all. 18th century England even passes a law that allows witchcraft, but bans fake claims of witchcraft for money-making purposes. So treasure hunting as well is suspended between magic and cynicism at this time.
Now, pirates.
In advance: pirates and privateers are NOT the same; privateers were essentially private contractors hovering above the line of legality. I use them interchangeably here because (a) I mean both and (b) the lines between the two for 17th century Jamaica, what I'm talking about, are exceptionally blurred.
Pirates were pretty well known for being hot-blooded (mostly) young men who hit the streets of Port Royal with their mates and spent a whole lot more than a few shillings "giving themselves up to all sorts of debauchery with strumpets and wine." So it might be kind of a surprise that pirates' views of both what constituted loot and what to do with that loot were quite practical.
First, there was always the possibility that the captured ship itself was a prize. When John Duglas captured the nine-man ship Blue Dove in 1664, it wasn't nearly good or big enough for his own crew, and the pirates simply locked the other sailors belowdecks and ported away the cargo. But saltwater was hard on the hulls of even good ships, and trading up in terms of size, weaponry, and condition was always tempting. Humphrey Thurston abandoned a ship still worth 300 pounds as an unsalvageable wreck (in the Caribbean, where vessels sold for much lower rates than in England) when he captured a Spanish man-of-war in 1670.
Although spending by privateers doubled the amount of alcohol sold in Jamaica in the 1660s, pirates were keen to cut out the middleman and use captured cargo as their source of food and liquor. The governor of Jamaica in the late 1660s even complained that privateers never bought actual food from his merchants and farmers! Modyford was grumpy about this, but land-based owners of semi- or not-actually-at-all legit privateer fleets were rather happier that they only had to supply breadstuffs--if that! Pirates intending on a long period at sea would butcher live animal cargo and salt the meat to preserve it for months of use. Sadly, they also killed, salted, and ate the dogs who kept sailors company and helped with pest control on ships.
But the most common fate for captured loot by far, of course, was basic economics: you have product, you sell it. In the heydeys of Caribbean piracy, the sale of booty in pirate-heavy towns was one of the most important factors shaping local day-to-day economy (not just sweeping sugar trade-driven trends). A single, lucrative haul of log-wood in 1667 crashed the price of the commodity in Port Royal for four months. More typical were steady low prices, locally, of things like cocoa and indigo that were sold dog cheap (or rather, "dogge cheape," because early modern English loves you and wants you to be happy).
This was a boon for local traders, of course, who went right on to sell those commodities elsewhere for a significant markup and profit. I have to mention that this was unfortunately true especially for captured slaves. For some reason, local plantation owners had no extra troubles when they treated captured pirates who had angered them as slave labor, but slaves seized off ships were called "mischief-makers" and sold off-island (this is a stock term in legal records more broadly, and can't be assumed to mean any one thing in particular). I've seen it suggested that pirate crews may also have retained specialized slaves for their own use and profit--pearl diving was a specific and valuable skill, and slave-divers were sometimes seized off attacked ships.
Pirates dumped their merchandise-loot into local economies, driving the development of major towns--and also smaller ones, to evade the larger towns' governments attempting to stick a hand in their profits. Even beyond hiring privateers, it was government policy to either approve or look the other way...and often to participate.
In the British colonies, island and continental alike, trading with pirates was good business, ubiquitous, and tacitly approved (if not also practiced!) by government officials from the second half of the 17th century.
To tighten economic control over (hence economic revenue of) their nascent colonial empire, in the 1650s and 60s Britain passed a series of legislation collectively known as the Navigation Acts that sought to keep English (metropole and colonies) trade in English hands and English ships. The most relevant ones here required English colonies to buy European goods from England (or at least shipped on English ships with English crews) and to sell their goods to England. Tariffs, price hiking, and limitations of market made this a not-so-great economic deal for colonial parties in all cases. Trade with pirates and with smugglers (good amount of overlap, of course) was a convenient way to skirt some of the official taxes and restrictions. And there was always the option of going semi-legit by securing a commission/letter of marque from the government (agreeing to pitch them a share of booty, basically, with the idea being you'd not attack other ships under that government's or their allies' flag)--hence the fuzziness around who was a "pirate" versus a "privateer" at any given moment.
It wasn't just Britain, either! At the beginning of the 17th century in Cuba, the fed-up governor wanted to accuse his lieutenant governor, the island's plantation-owning elite, and the whole population of entire towns of participation in under-the-table trade. But, the governor's aide pointed out, doing so would completely destroy the island's economy.
That's because most of the money stayed local. The cash flow back out to seafarers, even with the dirt cheap prices, should have been enormous. But pirates were the live fast die young sort (a study of 12 privateer captains identified in sources from 1662-63 and again in 1670-73 found that after just a decade, 7 were dead, 1 was in jail, and 4 were petty laborers). And so all that money they received from selling their loot went right back into the pockets of the locals who had exchanged it in the first place.
...Only to, you know, complain bitterly to anyone who would listen how frequently they were the target of raids from pirates whose way of life, after all, was stealing.
I strongly recommend that you read /u/sunagainstgold 's excellent answer for a more comprehensive answer, but I would like to address a specific example, which is that of William Kidd, from which this legend (probably) springs.
William Kidd was a privateer turned pirate (I want to emphasize that this was, at the time, often a purely legal distinction, and while I don't have as much time as I would like to go into specifics, the line with Kidd is VERY blurry) who found himself in trouble with the law after returning from an expedition to the Indian Ocean, where he had engaged in some dubious attacks on merchant vessels and killed one of his crew in an altercation.
Kidd, contrary to common perceptions of pirates, was not an outcast or criminal, but a friend (or at least an acquaintance) of several wealthy New York gentlemen, including Richard Coote, 1st Earl of Bellomont himself, who was colonial governor at the time and had invested in his expedition.
Perhaps not understanding the extent of the legal trouble he faced, Kidd buried some of his plunder on Gardiner's Island, off the coast of Long Island, intending to use it as leverage with Bellomont and his other backers. Unfortunately for Kidd, he was simply arrested and Bellomont later dug up the treasure to use it as evidence against him, who was summarily convicted of murder and piracy, and hanged.
This is, as far as I know, the only concrete* example we have of pirates burying treasure, but as /u/sunagainstgold rightfully illustrates, that does not mean that burying treasure did not happen.
EDIT:
*This is not precisely true, as /u/Elphinestone1842 has pointed out below