Kings who conquer nations often gather great personal wealth from the spoils of war. David, however, took a different path with the immense riches and military plunder he acquired. The various gifts and offerings brought to him were channeled toward a high spiritual purpose. Rather than funneling these treasures into his private accounts [ביאור שטיינזלץ], David chose to dedicate them to God. This decision directly fulfilled the Commandment of God that forbids a king from hoarding excess silver and gold for personal gain [חומת אנך].
The dedication of these treasures served a clear and practical goal. David aimed to stockpile massive quantities of precious raw materials, safely preserving them in the sacred treasury to be used for the future construction of the Temple [רד״ק, ביאור שטיינזלץ]. He combined these voluntary gifts with the spoils of war that he personally captured and carried away from the battlefields [מצודת דוד, מצודת ציון]. This wealth was gathered from a variety of defeated nations, including Edom, Moab, the Ammonites, the Philistines, and Amalek. While a parallel historical account also mentions Aram among the conquered nations, that specific name is omitted in this instance simply for the sake of brevity [רלב״ג].