The sun heats the water to steam and that steam then drives the steam engine. In the 1890s the solar boiler had to be repositioned every so often in order to maintain its position in relation to the sun. Today we have electronic tracking devices that, installed on the solar boiler, will automatically reposition the boiler to maintain its position with the sun. It won't be completely free because, every once in awhile, you will have to replace the batteries that wear out. You may never have to replace the steam engine itself.
Steam engines have other advantages that, in regards to the wear factor, outclass gasoline engines.
Steam engines normally have much larger bearing surfaces against the crankshaft. One steam engine in England ran 24 hours a day from 1800 to 1950.