A wave has the ability to transfer energy without mass transfer. In the case of the waves in the sea, the water molecules move and carry energy with them but they do not displace large distances as the wave itself does.
Then, the energy is trasnferred from the water to the shore but the water does not travel with the energy.