The carburetor in your lawnmower has a simple fuel float that detects how much fuel is in the mower. If you notice gas leaking through the air filter, the gas has backed up from somewhere inside the engine and is overflowing. Because the carburetor is closely connected to the engine air supply, it is often the culprit and the first place you should examine for potential clogs and dirt.
The carburetor float can become permanently stuck in the open position, which allows gas to flow up through the air filter and out of the mower. This is usually a sign of dirty fuel. Cleaning the float and carburetor and replacing or cleaning the fuel filter can help resolve this problem. If you have not used your mower in a long time, stale fuel may have gummed up the float, causing it to stick open and requiring the same cleaning procedure.
If your mower has a fuel shut-off valve, check it for signs of sticking or damage. The valve should automatically close whenever the engine is not on. If the valve is still open when the mower is fully powered down, it may be letting fuel leak into other parts of the system. You can solve these issues by replacing the valve with a new one.
If gas is leaking through your lawnmower's air filter, there is also a chance that it is leaking in other areas, specifically into your oil. If you notice a gas leak, drain the oil you currently have in the mower and replace it. Oil mixed with gasoline can be dangerous for your engine.