We don't know which one the answer is talking about or if it is correctly characterizing the situation. Many yachts have been seized but not expropriated because the (laws authorizing) sanctions allow for the freezing of assets of "Specially Designated Nationals" (=sanctioned). Potentially, if sanctions are lifted, these individuals can have their stuff back, including yachts.
the process of detaining a yacht is rather boring. Most of the 16 yacht “seizures” that have occurred so far have been more like freezes, according to Alex Finley, a writer and former CIA officer who has been tracking the seizures. First, a country will notice that a large, majestic vessel is parked in one of its shipyards and attempt to ascertain its true owner—a process that requires cracking open shell company after shell company, a nesting doll of paperwork, if you will. If the yacht is indeed connected to an oligarch, the country’s port authority simply forbids the yacht to move. The yacht remains at the dock, and the oligarch can’t use it for a while. The owners aren’t usually on their yachts when the boats are seized, [...] Nor are the boats chained to the docks with comically large padlocks, as I had hoped. “They just are not given permission to leave,” Finley said. [...] Some countries are deregistering the yachts, negating their insurance, which discourages the boat from sailing off. [...]
“DOJ is interested in identifying all properties of sanctioned oligarchs and ensuring, to the extent possible, that those assets are ‘blocked’ from use or enjoyment.” If a yacht can be traced to criminal conduct, the agency said, “DOJ is interested in going further, where possible, and actually forfeiting the property.”
Dealing with these seized yachts, though, can be kind of a headache. If left in brackish water for months, the boats’ hulls will corrode and, eventually, the yachts could sink. [...] When the U.S. government seizes, say, a Lexus or a helicopter from a drug dealer, it takes on the cost of storing and maintaining it. “The government doesn’t own it yet,” says Stef Cassella, an expert on asset-forfeiture law. “It still belongs to the other guy, and he might get it back. And if he gets it back, then he has a right to get it back in the same condition that it was in before it was seized from him. Otherwise he gets to sue the government for damages.” Occasionally, the feds will pay a contractor to, say, mow the lawn of an alleged drug kingpin’s mansion or half-heartedly run the small business that was previously a front for money laundering.
Expropriation would typically involve civil forfeiture due to said assets being involved in a crime, not merely due to sanctions, although attempting to evade sanctions is a crime. I am aware of one yacht the US claims to have seized and wants to expropriate because, the DOJ says, there were (further) maintenance payments made on the yacht in violation of the sanctions, which would also constitute banking fraud.
It is further alleged that Vekselberg used shell companies to obfuscate his interest in the [yacht] Tango to avoid bank oversight into related U.S. dollar transactions. [...] Additionally, despite his status as an individual under sanction, Vekselberg, and those working on his behalf, continued to make U.S. dollar payments through U.S. banks for the support and maintenance of the Tango and its owners. [...]
When finding that probable cause supported the warrant, the Court first observed that willfully attempting to circumvent U.S. sanctions, such as trying to circumvent the anti-money laundering (“AML”) procedures implemented by U.S. financial institutions under the Bank Secrecy Act to prevent the misuse of correspondent bank accounts, is a criminal violation of the IEEPA. Further, deceiving banks which are trying to enforce U.S. sanctions law through their AML programs is bank fraud. Moving funds involved in such activity is money laundering.
[...] The Court agreed that the government had established probable cause to believe Vekselberg structured transactions involving the Tango to conceal his identity, including via use of shell companies, as part of a scheme to violate the IEEPA and commit bank fraud, as part of a related international money laundering scheme. These transactions were subject to U.S. jurisdiction because they passed through the United States via correspondent bank account transfers. The Tango therefore was subject to forfeiture under 18 U.S.C. Sections 981(a) and 982(a).
This is broad topic, but if the question is somehow whether [non-UNSC] sanctions themselves are legal under international law, that's a complicated can of worms. Basically no body of relevance found them illegal (save for some UNGA resolutions led by developing countries, which alas have legal force of the peanut gallery; an ICJ tribunal found the opposite in the Nicaragua case). The WTO in particular (which is relevant as most countries involved here are members) found that some sanctions--in particular traffic restrictions--are permissible if “taken in time of” an “emergency in international relations” (That was a case involving Russia and Ukraine. It was Ukraine which had complained against Russian sanctions, by the way.)
Whether seizing some boats in port is deemed permissible under international law due to sanctions in an “emergency in international relations” (or even any other reasons) is frankly less tested, at least under modern trade frameworks, like WTO. (I suppose one might argue that preventing the ships/yachts from leaving port is just a form
of traffic restrictions.) In a more customary/historical context, considering it just a law of the sea matter, the answer is almost certainly yes.
Treaty and customary law restrict seizures of foreign merchant ships to ships transiting a state’s territorial waters, with an essentially blanket ban against seizures on the high seas.
[...] when the United States wants to seize a foreign vessel without flag state consent, its options under international law are limited. They include co-opting flag state action against a vessel [or] use of third-party state enforcement as the ship in question transits their territorial waters (as in Grace 1).
The latter is pretty much what happened to most of the yachts. (US courts went a bit further than that and gave the US admiralty jurisdiction in a few more cases even on the high-seas, but those aren't terribly relevant to the yacht events insofar.)