Where I live (Illinois) both mopeds and ebikes have a legal definition, and there are plenty of restrictions on the latter..
Mopeds require a drivers licemse. If the engine size is under 49cc, an automotive license is required. For larger engines, a motorcycle license is needed. You need to register, insure, and license a moped. You need to have lights tor ride at night. They cannot be ridden on bike paths or in bike lanes..It costs $141 to register a moped here, and the plates will be $41 annually.
Meanwhile ebikes with motors under 1 HP (750watts) are allowed to be ridden like bicycles.
.