The objects have different densities
They objects may possess the same volume; however, due to a difference in density, they do not possess the same mass within that volume. This means that they experience a different gravitational force, which causes one to sink and the other to float.