Dedicated stormwater infrastructure separate from sewage pipes solves the problem. You can also build tanks to hold overflow.