Many ocean-going vessels will register as Liberian or Panamanian because those countries do not demand taxes or fees of their merchant ships. What does it benefit Liberia and Panama to do this?
Well, Panama and Liberia (and Vanuatu, another common flag of convenience) actually do charge taxes and fees. It’s just that their taxes are extremely low.
So, flag of convenience countries get this revenue stream (small from each ship, but they add up).
The main problem in most countries is the requirements for a certain quota of nationals among the crew, or a certain amount of union access. Most shippers want to avoid these, but most politicians in US and elsewhere have bigger fish to fry, so they won’t relent except for foreign-flag ships.
One problem with foreign flag, that’s very real, is lack of US protection from pirates, especially near Indonesian waters.
Ancient problem, simple solution: Buy some guns from a no-tell nation (note: learn Russian) and defend your own damn ship. If this was practiced more widely, Levi’s and Nike would all but solve the piracy problem to defend their supply lines (the output of Indonesian sweatshops). JKOS (Just Kidding, Only Serious)