It's a system called registering a ship under a "flag of convenience" [1].
Covers lots of questionable business practices, from employment conditions/health and safety, to tax etc.
[1] https://en.wikipedia.org/wiki/Flag_of_convenience
Edited to add this (which I did not know, but think it interesting) from the Wikipedia article:
The modern practice of ships being registered in a foreign country [ie, a flag of convenience] began in the 1920s in the United States when shipowners seeking to serve alcohol to passengers during Prohibition registered their ships in Panama. Owners soon began to perceive advantages in terms of avoiding increased regulations and rising labor costs and continued to register their ships in Panama even after Prohibition ended.