The stamp doesn't touch the silicon or any other solid material, it hovers just above.
It only touches a liquid photo-resist that is spread on the wafer. The stamp is transparent, which allows UV light to shine though and exposes the photo-resist, which solidifies into a mask matching the stamp.