Yes, they did! Although buried treasure is often seen as a myth made up by popular culture (namely Robert Lewis Stevenson's Treasure Island), William Kidd is the only pirate to have evidence supporting this claim.
This is a very interesting fact sheet written by Dan Conlin, Curator of Marine History at the Maritime Museum of the Atlantic in Halifax, Nova Scotia. Conlin includes an excellent list of further reading.
It wasn't a Hollywood thing, it was more of a legend which developed during the Victorian era.
The only historical account we have of buried treasure concerns William Kidd, and there is controversy over whether he was even really a pirate or just an unlucky victim of circumstance. He buried a small amount of treasure on Gardiners Island in New York state in 1699, once he realized he was being hunted as a criminal. The Island's resident and owner, Lion Gardiner, was ordered to bring it to Boston for Kidd's trial, and it was used as evidence against him.
Kidd's arrest, trial, and execution were quite sensational and widely publicized, and his name entered folklore in the colonies. There were stories told in taverns up and down the East coast of the US and Canada that he had buried treasure on whatever islands were nearby.
The tales told about Kidd influenced the writing of several Victorian-era stories which feature buried treasure as a major plot point, including The Gold-Bug by Edgar Allen Poe and Treasure Island by Robert Louis Stevenson. In the preface to Treasure Island Stevenson talks about owing a debt to Washington Irving and admits he stole a little of the plot from him. This is referring to Wolfert Webber, or Golden Dreams, a short story Irving wrote and published in a book called Tales of a Traveller in 1824. One of the characters is an old man who frequents the local tavern telling tall tales about Kidd's buried treasure.
A couple of good references on the subject:
Under The Black Flag: This book discusses many of the myths and legends surrounding pirates (like walking the plank and burying treasure) and explains the reality that underlies them.
The Pirate Hunter: This book contains a very detailed account of the Gardiners Island treasure and what happened to it. It is by far the best researched account of Kidd's life I have come across.
Other posters have touched on the heart of it, but here is a little elaboration if you want to know more:
The only recorded instance of pirates burying treasure anywhere is when Captain William Kidd buried a portion of his ship's cargo on Long Island before meeting with Richard Coote, Earl of Bellomont and Governor of New York. It bears mentioning that he didn't bury this treasure specifically to dig it up later, but because he was facing charges of murder and piracy and his goods were likely to be seized.
He buried the treasure to use as a bargaining chip with Bellomont, hoping it would give him leverage and help him avoid going to trial (Bellomont was one of his benefactors and had even financed a previous voyage). This tactic failed completely, and Kidd's treasure was simply dug up. There are rumors that portions of it remain buried, but this is almost certainly nonsense.
I'd also like to point out that Kidd, in terms of what we usually refer to as 'pirates', hardly qualifies at all. He was well known and respected among the colonial nobility, went to sea with the funds and blessings of many high-ranking people, and happened to end up on the wrong end of a political scandal and with his hand in the cookie jar, so to speak. His trial was rushed, and he may have even had a legitimate letter of marque, making him a privateer, not a pirate.
Robert Louis Stevenson used Kidd (or rather, the fictionalized Kidd-as-pirate that had persisted to the late 19th century) as a prototype for Long John Silver, and embellished the part about burying his treasure. Treasure Island is really the root of so many of the pirate icons we know and love (peg legs, parrots, buried treasure, etc.).
If you're interested in learning more, I recommend you take a look at Captain Kidd and the War Against the Pirates, The Pirate Hunter, and Under the Black Flag.
Edit: It's actually Gardiner's Island, as one of the above posters mentioned, which is near Long Island, but is separate.
Sorry I'm coming so late to this, but I think I can add to the answers.
First off, Kidd is the most well-known example of a pirate burying treasure, but he may not have been the only one who did so:
Drake buried a load of silver on a beach in Panama in the early 1570s, but it was only intended to stay hidden for a few days while Drake and his men went overland to fetch the ships needed to carry it away. Plus there's the whole question of whether or not Drake was a pirate...
The earliest buried pirate loot that I'm aware of was a stash of stolen goods buried by Lady Killigrew (who was NOT a female pirate by the way) in the garden of Arwennack House, just opposite where the National Maritime Museum: Cornwall now stand in Falmouth. Having ordered her servants to board and ransack a ship anchored off Falmouth she got windy about the authorities discovering her (not a big worry as her husband was Vice-Admiral of Cornwall) and ordered six chairs to be buried in the garden. I'm not sure whether you'd really call this "treasure" but it certainly qualifies as "pirated valuables".
Peter Easton was believed to have had more treasure than he could keep on his ship so buried some in Southern Ireland around 1611 (Off the top of my head I can't recall if this is mentioned in Clive Senior A Nation of Pirates, but the original source can be found in the relevant Calendar of State Papers, Ireland). This doesn't prove that Easton actually did bury treasure, but it does prove that the concept pre-date Kidd by several decades.
Also unproven, Henry Every was believed by contemporaries to have buried his share of the loot from the Gang-i-Sawai in Cornwall in the region of the Lizard, either at Gunwalloe or Kennack Cove. The first mention of this is a 1701 letter from a Mr St. Lo to Secretary of State James Vernon, who believed the story enough to offer a reward to anyone who found it and turned it in. (Calendar of State Papers Domestic, 1700-1702, p. 216)
Next, in 1707, the English pirates left on Madagascar had amassed treasure, and there were great concerns in London that all that money ‘now lies buried or useless’, as ‘unprofitable as the Earth that covers it’.(Reasons for Reducing the Pyrates at Madagascar (London, 1707), p. 2)
Charles Johnson's General History of the Robberies and Murders of the Most Notorious Pyrates (London, 1724) is not always altogether reliable in the details, but for what it's worth, it describes John Rackham's crew as hiding their ill-got wealth in a cave on Cuba. Not quite buried but I think it qualifies for interest.
Finally, a case of buried treasure that was not all it seemed. In 1723 the British vice-Consul at Vigo was approached ‘by a Mulatto, a Native of St. Antonio one of the Cape de Verde Islands, that he knew of a considerable Treasure which had been buried in that Island by a Crew of Pyrates’. The vice-Consul hired a ship to sail to the island, where they were attacked and driven ashore by some pirates and later picked up by the Spanish navy. The vice-Consul and his men were shipped back to Spain to face a diplomatic crisis while the Verde Islander was executed. As it turned out, there was no buried treasure, it was just a scam by the Islander who wanted a free passage home. (London Gazette, 22/10/1723).
Secondly, the question of Kidd's guilt as a pirate, though not strictly relevant, is an interesting one. Zacks makes a good argument that his capture of the Quedah Merchant was technically within the terms of his privateering commission, thus exonerating him of his most notable charge of piracy. However, during the course of his cruise he also attacked other ships, included vessels of the East India Company, which were not covered by the terms of his commission, so while he may not have been guilty of piracy on the Quedah Merchant it's difficult to exonerate him entirely of piracy. Moreover, Kidd was not executed for piracy anyway, he was executed for the murder of William Moore, the gunner of the Adventure Galley, whose head Kidd had stoved in with a bucket (I'm not making this up folks!) in a fit of rage.
The stories and legends predate Hollywood.
While it is 9/10ths story, there's at least one recorded instance of it happening. Speaking broadly there just isn't that many reasons pirates would bury treasure in the piss middle of nowhere, and then make a map to remember how to get back there. Its just not a good insurance policy. Especially for a line of work that was rather notorious for the financial short sightedness of it's workers.