It is simple: Tech companies are allowed to test their systems on public roads because the communities/states have given them permission to do so(with restrictions like roads allowable, max/min speed allowable, safety driver present behind wheel, etc).