It's been tried, but it is very, very lossy. Here are some ballpark numbers to illustrate the problem, compared with a conventional chain driven bike.
Sustained pedal power input from an average cyclist ~100W (Lance Armstrong can reputedly hold around 400W for maybe an hour, but he's exceptional)
Chain drive losses ~ 1% to 3%, depending on state of chain, relative size of sprockets and type of lubrication used
Generator losses ~ 15% for an 85% efficient generator, which is typical. The best generators maybe just over 90% efficient, but only over a narrow range of load conditions and speeds.
Motor losses ~ 15% for an 85% efficient motor, again this is typical. Permanent magnet motors and generators are reciprocal machines, so the same rules pretty much apply to both.
Let's assume that the other mechanical losses, from bearings etc, are the same for both chain drive and generator/motor drive, so cancel each other.
Let's also assume a perfect electrical system, with no wiring or other I²R losses.
Here's the comparison:
Chain driven bike with 100W input to the pedals will deliver around 97W to 99W to the rear wheel and waste around 1% to 3% of the rider power as heat.
Pedal generator/motor driven bike with 100W input to the pedals will deliver around 72W to the rear wheel and will waste about 28W as heat. If run at the generator/motor best efficiency point all the time (around 90% for both) then the power to the rear wheel increases to around 81W, with losses of around 19W as heat.
The bottom line is that the relatively poor efficiency of the generator/motor set up makes it a poor choice. Chains are surprisingly efficient, and waste very little power, which is why bikes have stuck with them for so long.
Jeremy