The cost of an electric generator will depend greatly on the amount of power output that you desire as well as noise levels.
In general, they’re less expensive than gas generators overall but this isn’t always the case and it’ll also depend on where you live and what type of fuel is available locally (such as standard electricity rates vs. solar energy).
Gas-powered generators typically use normal gasoline which makes them more economical in some ways although the initial cost might be a bit higher than an electric one depending on how much horsepower you need behind your unit.