So what prevents that happening on earth?
Not much. Quite a lot of water is recycled into the Earth's crust and mantle.
So the only thing that prevents the water from sinking in is the temperature, right?
That's part of the story. For our discussion, water can exist in two forms:
- Molecular water as H2O, being in one of several phases (liquid water, solid ice, supercritical fluid, water vapour),
- Structural water in solid minerals. For example, in clay minerals aka mud. Kaolinite is one of the minerals that make up mud (or dust) and has the formula Al2Si2O5(OH)4. See that (OH)4 in there? That's basically water. Even if you take a pile of mud, dry it at 110 °C in an oven until it's completely dry, the water is still going to be in there.
Molecular water can react with rocks and minerals to form hydrous minerals and get trapped as structural water (similar to adding water to Portland cement in the making of concrete), and hydrous minerals can be heated enough to release this water (usually requiring hundreds of degrees).
Let's look at some examples of how this thing might work.
Oceans have mid ocean ridges, where the oceanic lithosphere is being formed. This area has very shallow magma chambers so the rock is extremely hot. Water that percolates down through cracks gets heated to a large degree, lowering the density and increasing the buoyancy of the water. This water then goes back up through hydrothermal vents on the seafloor. Here's a spectacular video of some of those things:
When the water goes down, not all of it goes back up. It also reacts with the rock, forming hydrous minerals. For example, anorthite (CaAl2Si2O8), a common mineral in basalts, is hydrated to epidote-clinozoisite: Ca2Al3Si3O12(OH). In some occasions, oceanic crust can be uplifted and is then exposed. One example is Cyprus, where you can see features like this:
What you're looking at is basically anhydrous rocks (the white stuff) replaced by hydrous minerals (the brown stuff) due to upwelling hot water in the oceanic crust. Above it, now gone, was a hydrothermal vent like the ones in the video.
On land, water does sink deep down as well. As Gordon mentioned in his answer, water is common in oil reservoirs, but it's just about anywhere else. It is particularly rich in sedimentary rocks, that still have some amount of the liquid water that existed during sediment deposition (river, lagoon, lake, etc).
A good property of water in subsurface conditions, is that at higher temperature and pressure it can dissolve and leach metals from rock. This provides a way to move metals around, eventually depositing these metals in localised locations so we can exploit them. Lead, zinc and gold are examples of metals that can be concentrated by circulating water.
Water can also go deep down into the mantle in subduction zones. Water trapped in pore spaces and hydrous minerals can sink hundreds of kilometres down into the Earth. Eventually, the temperature becomes too hot to sustain the water in there and the rock devolatilise: they lose the water (which is a supercritical fluid at this stage). This water is then incorporated into magmas, and erupted in volcanoes. In many volcanoes, especially in arc volcanoes (such as the ones around the Pacific ocean), a major component of "volcanic gas" is actually water vapour.
To sum it up, water goes down, water goes up. It's all one huge happy cycle.