Behind the carefree holiday of a cruise—the dancing waiters, the constant shows and events, the spreads of great food, and the escape from daily drudgery—is a serious industry that has changed what people expect out of a vacation. It was built by several entrepreneurs who took advantage of changes in American lifestyles, married the design of a resort with the rhythm of a theme park, put it on a boat, and won sweet deals through giant loopholes in American laws.

As a business model, the cruise industry has been phenomenal, a $40 billion business in the United States alone, and the fastest-growing segment of the global tourist industry. Cruises are the future.

But cutting corners and avoiding laws have had serious downsides. Cruise ships are not subject to the requirement for federal permits covering sewer and waste disposal systems that are de rigueur for the resorts and hotels on land. As a result, all of those millions of passengers and crew members dining and defecating and showering on the oceans have left filthy discharges in their wake. On land, the cruise crowds streaming into foreign ports by the thousands have disfigured beaches and plazas, building resentment among many locals. Many ports have taken on the life of a strip mall. St. Mark’s Square in Venice is now a field of kiosks selling cheap imports and lines of tourists waiting to visit the basilica.

Having fun on a ship sailing in the middle of the ocean requires prosaic essentials recreating all of the systems hotels on land take for granted as well as the underpinnings of the ship: the navigation system, engines, power plant, water filtration and purification plants, sewage plants, photography plants, laundry and dry-cleaning facilities, kitchen galleys, a morgue, and storage lockers for the 100,000 pounds of food required to feed 3,000 people every day on a cruise. Also hidden from view are the below-sea-level accommodations for the 1,200 crew members.

These fun ships grew ever larger to incorporate all the services necessary to run a miniature town, becoming megaships with space for elaborate playthings like the skating rinks and climbing walls. And the passengers keep coming. It is no anomaly that cruises singularly turned a profit in the recent Great Recession of 2008. While Las Vegas and its casinos suffered and the airline industry went into the doldrums, the cruises were the financial rock star of the tourism industry, remaining the most profitable sector of tourism.

One key is the very cheap wages cruise ships pay.

After World War II, American shipping companies began flying foreign flags and registering in foreign lands. They saw this as a lifeline for becoming competitive by circumventing American minimum wages, which meant paying their sailors far less money. Under strong pressure from the shipping industry and its friends, the U.S. Congress upheld the legality of foreign registration.

This supposedly temporary fix to reduce labor costs and avoid expensive regulations became a fixture in the world of maritime transportation. So what if these maritime rules were meant for ships transporting goods, not floating hotels? A ship is a ship. Even though Carnival was an American corporation headquartered in Miami with an American client base, Carnival decided to register and flag its ships in foreign countries that had nothing to do with their business. It didn’t matter where the ships traveled or where they established home ports. Cruise companies could register and flag their ships wherever it was best for their bottom line.

Today the majority of ship owners are based in wealthy maritime nations like the United States, Great Britain, Norway, Greece, and Japan, but their ships are registered and flagged in foreign countries with “open registries” — that essentially have no minimum wages, labor standards, corporate taxes, or environmental regulations and only a flimsy authority over the ships flying their flags. All these countries require is that ship lines pay a handsome registration fee.

Carnival registered its fleet in Panama. Royal Caribbean registered its ships in Liberia. (During its two-decades-long civil war, Liberia earned at least $20 million every year by acting as the off-shore registry for foreign ships.)

Cruise lines gain another enormous advantage by registering as a foreign corporation. The Internal Revenue Code exempts any income from airlines or ships from taxation as long as the foreign nation gives the same benefit to American corporations. Neither Liberia nor Panama nor any other open-registry country levies a corporate income tax.

This business model is every corporation’s dream. Indeed it has been so successful that Carnival and Royal Caribbean have been able to buy out their smaller competitors while expanding their fleets with new ships. Today the two firms account for 66 percent of the global market; Carnival at 45 percent and Royal Caribbean at 21 percent.

As the American lines expanded to the United Kingdom and the rest of Europe and then into Asia, annual passenger load tripled from 500,000 in 1970 to 1.5 million in 1980, and then grew exponentially to 4 million in 1990 to over 13 million in 2010. The cruise industry reached the phenomenal growth rate of 1,000 percent in four decades.

Meanwhile, workers on these ships earned third-world salaries, or worse: many crew members working 10- to 12-hour days with no overtime pay and no days off for months; hourly wages as low as 53 cents; waiters living on tips because their monthly salaries were a token $50.

For decades, American unions tried to fight back against these practices. With a fleet of over 300 ships, the industry employed a lot of waiters, busboys, housekeepers, and laundry workers. When they weren’t happy with the working conditions, crew members jumped ship and told their stories at American ports.

Eventually, Congress held hearings. Representative William Clay Sr., then serving as a Democrat from Missouri, introduced legislation in the early 1990s to require cruise ships to pay minimum wages and provide other U.S. labor protections to workers on cruise ships operating out of American ports.

But the industry won the war over labor handily. Congress even helped the industry’s bottom line by reducing fees paid to the Immigration and Naturalization Service. The industry also blocked early bipartisan opposition to cruise companies avoiding corporate income taxes. Representative John Duncan, Republican from Tennessee, argued that “it is totally unfair to let Carnival Cruise Lines pay nothing on profits just because it was incorporated in Panama. … Foreign flag lines are, in effect, getting an indirect subsidy from the U.S. government.”

The industry refuted those charges, saying it pumped billions of dollars into the American economy — upward of $40 billion in 2010 — and created thousands of jobs in the United States.

Adam M. Goldstein, president and CEO of Royal Caribbean International, also responds to critics by citing the popularity of cruises. “The single most important driver of our success is how happy we make our customer. So you can talk about other things, you can talk about legal or tax regimes and you can have that conversation, but if we didn’t make our customers really happy on a regular basis at the highest level that we know of in travel and leisure, none of the rest of it would matter.”

Goldstein said that it was wrong to compare cruise wages to American pay. Rather, he said, the pay should be compared to what crew members would receive in their home countries — the Philippines, Turkey, Serbia, or India.

“Typically what they are able to earn from us is significantly greater than what they are earning if they would have stayed where they were,” he said. “So our view, not surprisingly, is that we provide fantastic employment opportunities to people from around the world that would not otherwise exist.”

Goldstein’s argument is what academics call the “race to the bottom” justification, a throwback to the early 20th century before societies mandated minimum wages, improved labor conditions and the right to collective bargaining. While those rights were codified in national laws and are enforced within national boundaries, they are laws that the cruise companies can ignore.

Another great source of revenue, according to Ross A. Klein, the author of several books on the cruise industry, is onboard sales, which “is becoming more profitable than ticket sales. On average, each passenger provides $43 in profits each day to the big cruise companies,” he said. “If you include all the onboard spending, it is now less expensive to stay in an upscale Caribbean resort than to sail there on a cruise ship.”