Elon Musk can keep giving away $1m to voters in battleground states, a judge has ruled - as a lawyer admitted the winners aren't chosen randomly.