People have tried that, and failed for various reasons:
You can’t move the ship out of any port without insurance
Insurance for a rusting hulk isn’t cheap
No nation on earth will let you park your uninsured rusting hulk offshore, as it will pose an environmental and navigational threat to the area
Even if you anchored outside a country’s 12 nautical mile economic exclusion zone doesn’t mean their navy/coast guard won’t bother you. They have maritime rights outside that area nonetheless.
You’d still need to take the ship in for maintenance somewhere, and now all your regulatory problems begin again.
People have tried that, and failed for various reasons: