I have my doubts of the motivations, as we only ever hear of how great it was to fight enemy X and take their women, sheep and gold. Is this a fair statement? Why don't the Hebrews ever attack neighbours just for being evil, but always remember to take some bounty?
Just going for the obvious answer here, but even if you do attack someone just for being evil, and you end up killing them, they've left a lot of stuff behind that they don't have any use for anymore.
Also, particularly in the early years of Israel, these spoils were not used for personal enrichment, but for providing for the Tabernacle and funding the Lord's work, and the Lord took that pretty seriously. See Joshua chapter 7, which takes place immediately after the battle of Jericho, for an example of what happened when someone broke the commandment to bring the spoils to the house of the Lord.
Many of the books of the Old Testament were written as an ancient near east war narrative. While reading these books it is helpful to understand them in the context of them being a part of this genre of literature.
There are elements of the narrative which are common across the genre such as claiming utter and complete victory over the enemy, even if the battle was ambiguous. Or, claiming the enemy has been completely destroyed regardless of the fact that this took place or not. Now this may or may not be the case in the Old Testament, however the important thing is that listing out the spoils was common and expected, and it would have been confusing for someone consuming this literature at the time, if this element has been excluded.
Also, as Mason mentioned, the spoils were sometimes an important element to the story. Another example is the account in exodus, where over and over God promises not only to free the children of Israel but promises that they will take their treasure as well.