A lawn mower backfiring when starting is usually caused by the fuel mixture being too lean or you might be getting too much fuel in the carburetor.
Sometimes the float needle on a float type carburetor on a riding lawn mower sticks open allowing too much fuel to get into the carburetor.
That can then cause a backfire when you start the engine.
Water contaminated fuel in the lawn mower can also cause your lawn mowers engine to backfire upon starting and can also cause loss of engine power.
A lawn mower carburetor that has too much air in the mixture can also cause a backfire upon starting.