A tamper is a machine that rides the rail and picks them up and tamps down the ballast, measures the track geometry and lines the rails. An undercutter goes the rail in the ties, scrapes out all the ballasts and dirt underneath. Then it filters the dirt through conveyor belts by the use of conveyor belts.
Different screens separate the ballast from the mud.
The ballast is reapplied to the tracks. The tamper runs behind that. The secret in servicing is to provide drainage. That destabilizes the track structure and causes surfacing and alignment problems. The result is low spots, low joints and a bumpy ride.