The ice likely arrived via impact (Mercury’s covered with impact craters); much of it vanished back into space, particularly on the daylight side. It used to be thought that Mercury was in 1:1 resonance and showed the same face to the Sun, but that was found to be not true when technology emerged that made it possible to study it directly. So, the ice arrives and hangs out a while, then the Sun comes out...
Mercury has no Axial Tilt. Hence why this is possible. :)