Video: A country's territorial waters reach twelve miles off its coast, which means it can make up the rules there. Twelve miles beyond that is the contiguous zone where the country can only enforce laws regarding customs, taxation, immigration, and pollution. Up to 200 nautical miles off the coast is the exclusive economic zone (EEZ), which is sort of international waters but only that country has the rights to harvest the natural resources there. One country, three different levels of laws over the ocean.
That's all pretty easy to understand, right? Well, it can get pretty complicated when countries overlap and different countries have different laws regarding citizenship. But Wendover Production has done a good job explaining the nuance of maritime law and how ships duck the law by registering their boats in different countries where taxes are lower or have more lenient laws. A ship just needs to follow the laws of their country until they reach a different country's territorial waters.