It can, sort of. By treating the higher gears (the ones which cause the motor to assist above 15 mph) as, "off road" gears, the bike could remain legal, I think.
It depends on the wording of the law. If the law says, "capable of assisting" then more than likely ilegal. If it says, "does not...