What makes gambling wrong but insurance right?
Almost a decade ago, I tried to place a bet with a leading UK betting shop that I would die within a year. They should have taken the bet - I am still alive.
But they will not gamble on life and death. A life insurance company, by contrast, does little else.
Legally and culturally, there is a clear distinction between gambling and insurance. Economically the difference is less visible.
Both gambler and insurer agree that money will change hands depending on what transpires in some unknowable future.
Find out more
50 Things That Made the Modern Economy highlights the inventions, ideas and innovations which have helped create the economic world we live in.
It is broadcast on the BBC World Service. You can find more information about the programme's sources and listen online or subscribe to the programme podcast.
Gambling tools such as dice date back millennia - perhaps five thousand years in Egypt. Insurance may be equally old.
The Code of Hammurabi - a law code from Babylon, in what is now Iraq - is nearly 4,000 years old. It includes numerous clauses devoted to the topic of "bottomry", a kind of maritime insurance bundled together with a business loan.
A merchant would borrow money to fund a ship's voyage, but if the ship sank, the loan did not have to be repaid.
Around the same time, Chinese merchants were spreading their risks by swapping goods between ships. If any single ship went down, it would contain a mix of goods from many different merchants.
But all that physical shuffling around is a fuss. Much more efficient to structure insurance as a financial contract instead, something the Romans did a few millennia later.
Later still, Italian city states like Genoa and Venice developed ever more sophisticated ways to insure the ships of the Mediterranean.
Thirst for news
Then, in 1687, a coffee house opened on Tower Street, near the London docks. Run by Edward Lloyd, it was comfortable and spacious, and business boomed. Patrons enjoyed the fireside tea and coffee, and - of course - the gossip.
There was much to gossip about: London's great plague, the great fire, the Dutch navy sailing up the Thames, and a revolution which had overthrown the king.
But above all, the inhabitants of this coffee house loved to gossip about ships: what was sailing from where, with what cargo - and whether it would arrive safely or not. And where there was gossip, there was an opportunity for a wager.
The patrons bet, for example, on whether Admiral John Byng would be shot for his incompetence in a naval battle with the French. He was.
The gentlemen of Lloyd's would have had no qualms about taking my bet on my own life.
Edward Lloyd realised his customers were as thirsty for information to fuel their bets as they were for coffee, and began to assemble a network of informants and a newsletter full of information about foreign ports, tides, and the comings and goings of ships.
His newsletter became known as Lloyd's List.
Lloyd's coffee house hosted ship auctions, and gatherings of sea captains who would share stories.
If someone wished to insure a ship, that could be done too: a contract would be drawn up, and the insurer would sign his name underneath - hence the term "underwriter". It became hard to say quite where coffee-house gambling ended and formal insurance began.
Eight decades after Lloyd had established his coffee house, a group of underwriters who hung out there formed the Society of Lloyd's.
Today, Lloyd's of London is one of the most famous names in insurance.
But not all modern insurers have their roots in gambling. Another form of insurance developed not in the ports, but the mountains.
Alpine farmers organised mutual aid societies in the early 16th century, agreeing to look after each other if a cow - or child - fell ill. While the underwriters of Lloyd's viewed risk as something to be analysed and traded, the mutual assurance societies of the Alps saw it as something to be shared.
And when the farmers descended from the alps to Zurich and Munich, they established some of the world's great insurance companies.
Deep pools of risk
Risk-sharing mutual aid societies are now among the largest and best-funded organisations on the planet - we call them "governments".
Governments initially got into the insurance business as a way of making money, typically to fight a war in the turmoil of Europe in the 1600s and 1700s.
Instead of selling ordinary bonds, which paid in regular instalments until they expired, governments sold annuities, which paid in regular instalments until the recipient expired. Easy to supply, and much in demand.
Annuities are a form of insurance: they protect an individual against the risk of living so long that all their money runs out.
More from Tim Harford
Providing insurance is no longer a mere money-spinner for governments. It is regarded as a core priority to help citizens manage some of life's biggest risks - unemployment, illness, disability and ageing.
Faced with these deep pools of risk, private insurers often merely paddle.
At least, citizens in richer economies expect insurance from their governments. In poorer countries, governments are not much help against life-altering risks, such as crop failure or illness. And private insurers tend not to take much interest, either. The stakes are too low, and the costs too high.
That is a shame, because there is growing evidence that insurance doesn't just provide peace of mind, but is a vital element of a healthy economy.
A recent study in Ghana showed that farmers were being held back from specialising and expanding by the risk of drought - a risk against which they couldn't insure themselves.
When researchers created an insurance company and started selling crop insurance, the farmers bought the the insurance and expanded their businesses.
Today, the biggest insurance market of all blurs the line between insuring and gambling: the market in financial derivatives.
Derivatives are financial contracts that let two parties bet on something else - perhaps exchange rate fluctuations, or whether a debt will be repaid. They can be a form of insurance.
An exporter hedges against a rise in the exchange rate. A wheat farming company covers itself by betting that the price of wheat will fall.
The ability to buy derivatives lets companies specialise in a particular market. Otherwise, they would have to diversify - like the Chinese merchants four millennia ago, who didn't want all their goods in one ship. The more an economy specialises, the more it tends to produce.
But unlike regular insurance, for derivatives you don't need to find someone with a risk they need to protect themselves against. You just need to find someone willing to take a gamble on any uncertain event anywhere in the world.
It is a simple matter to double the stakes - or multiply them by a hundred. As the profits multiply, all that is needed is the appetite to take risks.
Before the international banking crisis broke in 2007, the total face value of outstanding derivatives contracts was many times larger than the world economy itself.
The real economy became the sideshow, the side bets became the main event.
That story did not end well.
Tim Harford writes the Financial Times's Undercover Economist column. 50 Things That Made the Modern Economy is broadcast on the BBC World Service. You can find more information about the programme's sources and listen online or subscribe to the programme podcast.