1)
What was divided via the lottery?
1.
Malbim: It was only the portion for the entire Shevet, but not for people within the Shevet.
2)
Where did Hashem command so?
1.
Malbim: "Ach b'Goral Yechalek Es ha'Aretz" (Bamidbar 26:55).