According to the law of Moses, the people of Israel were allowed to take plunder from cities outside the land of Canaan (Deuteronomy 20:1–15) but not from the cities in Canaan itself (Deuteronomy 20:16–18). With the destruction of Ai, the Lord allows them to take plunder from the city. Perhaps this was allowed in order to provide Israel with the food they would need as they travel north to mount Ebal, since the central highlands were not as fertile as the area around Gilgal.1 Alternatively it could have been a reward to motivate the Israelites in battle.2,3
2 And you shall do to Ai and its king as you did to Jericho and its king. Only its spoil and its livestock you shall take as plunder for yourselves. Lay an ambush against the city, behind it.”