A federal judge has ruled two Michigan lawmakers must surrender to Tesla Motors Inc. records of their communications with lobbyists over a law barring the electric car maker from selling directly to customers.