Why is there gasoline in my generator's crankcase?
At the bottom of the carburetor is a bowl and inside is a float-actuated valve.  Gas is gravity fed from the tank to the bowl, and when the bowl fills up, the valve is supposed to close off flow from the tank.  When that fails, gas can continue through the carburetor and into the idle engine, and eventually make its way into the oil at the bottom of the crankcase.
You will need to thoroughly clean the carb, and I'd recommend installing an inline fuel cut-off valve.  Lastly, you'll want to change the oil.