Answer
A ship is not a solid block of iron. It is hollowed out, and its hull can displace an amount of water whose weight is equal to that of the iron in the ship.
Work Step by Step
In other words, if you imagine closing off the top of the ship with a massless membrane, the overall density of the ship (mass/volume) is less than that of water. The ship floats.