Under U.S. law, if they're smart, anti-piracy and anti-narcotics interdiction. They're not, so they're citing sanctions.
Practically, however, this is sort of the endgame to the spheres-of-influence narrative. China can ram Phillipine fishing boats. Russia can steal children. America can commandeer random shit in the Western hemisphere.
The United Nations Convention on the Law of the Sea authorizes any state to interdict stateless vessels, which this was.
Here's an actual industry source which captures the whole story in the headline https://www.lloydslist.com/LL1155836/Weve-just-seized-a-tank...
I still don’t approve of it, but it does appear to be “legal”
It's really a good thing the US did this, one less dangerous stateless vessel at sea. Trump admin does lots of bad things, this is beyond reproach.