Simple. Offer them a better alternative next to a railway embankment, one that they find much more attractive for building a sett in.
Use the intelligence of animals. Rely on it to find ways to coexist peacefully with them in the habitats that we share with them.
Because we must learn how to do that.
I’ve only seen a badger ONCE in my life, on a Sunday morning near Loftahammar in Sweden, in 1989, more or less at the center of the image below, near the water.

