They are isolated from the vibration in the tank by rubber insulators mounting the tank to the frame. Level switches are mounted in engine oil pans , radiators and fuel tanks too. Vibration does not affect them either .
The same ( different style ) level sensors work in dry solids such as ash , dust or other materials...