In that case, the owner of the ship typically is still the original owner, but there is a whole "law of salvage" that determines what payment, or share of the treasure if it's things like sunken gold, the finder should get.
I don't know if that is the case with state ships. Recently Spain has recovered a gold and silver treasure from the odissey company(they recovered it from a spanish sunked 1800s tall ship)