Because contracts of insurance have many features in common with wagers, legislation generally makes a distinction, typically defining any agreement in which either one of the parties has an interest in the outcome bet upon, beyond the specific financial terms, as a contract of insurance. Thus a bet on whether one's house will burn down becomes a contract of insurance, as one has an independent interest in the security of one's home.
Furthermore, many jurisdictions, local as well as national, either ban or heavily control (by licensing) gambling. Such regulation generally leads to gambling tourism and illegal gambling, the latter often under the auspices of organized crime. Such involvement frequently brings the activity under even more severe moral censure and leads to calls for greater regulation. Conversely, the close involvement of governments (through regulation and gambling taxation) has led to a close connection between many governments and gambling organisations, where legal gambling provides much government revenue, such as in Monaco or Macau.
There is general legislation requiring that the odds in gambling machines are fair (i.e. statistically random), to prevent manufacturers from making some high-payoff results impossible (since these have very low probability, this can quite easily pass unnoticed).