This image provided by the Saddle Ridge Hoard discoverers via Kagin's, Inc., shows one of the six decaying metal canisters filled with 1800s-era U.S. gold coins unearthed in California by two people who want to remain anonymous.

A California couple was out walking the dog around their property last year when they stumbled across eight buried cans—with an estimated $10 million worth of gold coins inside. A year later, the rare coin dealer approached by the anonymous couple went public with the find on Tuesday. The long delay from find to fame was partly because of questions about how strong the couples claim to ownership was for the roughly 1,400 gold coins, dated from 1847 to 1894.

And it turns out that, in many cases, finders really are keepers.

Governments have been issuing rules about lost and found property—who owns it and how it shall be divided—for millennia. If a Roman walking around the Coliseum grounds in the days of Emperor Hadrian’s rule stumbled upon a half-buried pot full of bronze bars, half went to the lucky Roman, half to Hadrian. Today, if a Londoner unearths rare golden coins in his backyard, those belong to the royal family—who would likely pay the digger a handsome fee.

In modern day America, the presumption is “finders-keepers”—though there is a web of statutes and case law that can complicate such a simple maxim.

Generally, “the finder of lost property can keep it against all the world… qualified by the question of where it was found,” says property law expert John Orth, a professor at the University of North Carolina. In the case of “John and Mary” (as they’re being called) and their California coins, the strongest factor in their favor is that they found the coins on their own property. Even if someone could prove that their great-great-grandfather buried those cans, there’s likely little the descendant could do if their grandfather sold that land to John and Mary’s family. “When you buy something, normally you get anything that’s been hidden in it,” says Orth, offering the example of a man who bought a used car for $600 and gets to keep $10,000 he finds in the trunk.

If John and Mary had found the coins while taking a walk on someone else’s property, the booty would likely go to that landowner. But what if someone stumbles across something valuable on public property? Say a San Franciscan strolling across the Golden Gate Bridge finds a bag containing $1 million in cash. In California, there is a law mandating that any found property valued over $100 be turned over to police. Authorities must then wait 90 days, advertise the lost property for a week, and finally release it to the person who found it if no one could prove ownership. Orth says it’s rare for cities or states to make any claim to found property, like the goods that metal-detector-wielding treasure hunters find on public beaches, unless it has some historical or archeological significance.

A legal distinction that often comes to bear is whether property is abandoned, lost or mislaid. Abandoned property is something forsaken by a previous owner, who has no intention of returning for it. Lost property, like an engagement ring accidentally dropped in the street, is something that is inadvertently, unknowingly left behind. And mislaid property is intentionally put somewhere—like money on a bank counter that a customer intends to deposit—but then forgotten. Mislaid property, Orth says, is supposed to be safeguarded by whoever owns the property where it was mislaid until someone with a better claim, like the bank customer, comes back. Abandoned property and lost property are more likely to be dealt with by the easy “finder-keepers” edict.

An Arizona case, in which a man died after having hidden $500,000 in ammunition cans in his walls, helps illustrate the distinction. The man’s daughters, knowing he had a penchant for stashing things away, searched the house after he died before selling it to new owners. Years later, the new owners hired a contractor to renovate the house and he discovered the cans, hidden behind a wall-mounted toaster oven. The new owners said the money should come with the house, that it had essentially been abandoned. But as soon as the heirs found out about the stash they staked their own claim. An appellate court determined in 2012 that the funds were mislaid—having been intentionally put there, not unintentionally lost or thrown away—and awarded the money to the daughters.

A different court could have come to a different conclusion, of course. And cases can get much more complicated, especially when more than two parties are staking a claim. If a diver off the Florida coast happens upon a sunken ship with a trunk full of galleons, for instance, that might yield a legal battle among the finder and the state, descendants of the ship’s owners and any insurance company that paid a claim when the ship went down. “These cases are a mess,” Orth says.

A key piece of common law when it comes to sunken ships might be the same that appears to matter in John and Mary’s case—what is known as “treasure trove.” This is a fourth category—beyond lost, abandoned or mislaid—that refers to any property that is verifiably antiquated and has been concealed for so long that the owner is probably dead or unknown and certainly unlikely to pop out of a grave and demand that his goods be returned. “The obvious fact that these coins had to have gone into the ground in the 1800s certainly helps their case,” says David McCarthy, a coin expert at the dealer that is working with John and Mary.

When someone stumbles upon treasure, the most important question is likely whether someone else has a better claim. In the case of John and Mary and their $10 million pot of gold, anyone else making a claim that trumps their property rights has “a high hurdle” to meet, says Armen Vartian, an attorney specializing in arts and collectible law in Manhattan Beach, Calif.

“When people are arguing over who has a superior claim, the guy who hasn’t pursued his claim is at a disadvantage,” he says, giving the example of someone who said his family had been meaning to come retrieve those eight cans for the last century but just didn’t get around to it. “You might have had a right at some point, but you lose it.”