Captain Kidd did claim he buried treasure, but he did it as a stalling tactic to delay his inevitable hanging. There are no confirmed cases of pirates burying their treasure.
The myth largely sprung up from the novel Treasure Island. Which birth a ton of adventure tropes.
Gold was absolutely taxed and controlled In those days. Just because modern taxation didn’t exist, it didn’t mean that people didn’t ask ‘hey where did you get the money from?’
There have been cases as far back as Ancient Egypt where robbers were caught because they suddenly had access to large amounts of money they wouldn’t have had otherwise. I think it involved a group of people who robbed a Pharoah’s tomb. It has been decades since I read about it so I could be off.