When a stack bearing any magic items or artifacts, or a barbarian commander's purse, is defeated in battle, the capturing stack may claim those items, or "spoils" for themselves, using them. It is possible that a commander is necessary to use the item. It is less likely that they must be present to capture the spoils, but some units, such as uncroaked or dwagons may be unable, or at least less likely, to capture spoils.
Likewise, when a city is conquered, the victorious army may claim the treasury and any abandoned items as spoils. When multiple allied sides conquer a city together, they will split the spoils according to the terms of their alliance.