First of all, from a logical perspective, ‘anfāl’ and ‘war spoils’ aren't equal, and aside from this point, it must be said that from a one point of view, everything in the entire universe belongs to Allah (swt), but from another point view, some material endowments, without Allah’s ownership being disturbed, are also in the supposed ownership of people, and there is no contradiction between the two.
The verses that seem to be contradictory at first sight are:
a) “یَسْئَلُونَکَ عَنِ الْأَنْفالِ قُلِ الْأَنْفالُ لِلَّهِ وَ الرَّسُول...” (They ask you concerning the anfāl. Say," The anfālbelong to Allah and the Apostle…)
b) “وَ اعْلَمُوا أَنَّما غَنِمْتُمْ مِنْ شَیْءٍ فَأَنَّ لِلَّهِ خُمُسَهُ وَ لِلرَّسُولِ و...” (Know that whatever thing you may come by, a fifth of it is for Allah and the Apostle…).
In this regard, one must say that in addition to there being no logical identicalness between ‘anfāl’ and ‘war spoils’ (thus, resolving the seeming contradiction from the start), but there is also a point here that can clarify things further.
At first sight and from one point of view, everything in this universe, including our existence and everything in it that we can benefit from, belong to Allah (swt), and this is a reality that many verses of the Quran touch on:
1- “لِلَّهِ ما فِی السَّماواتِ وَ ما فِی الْأَرْض” (To Allah belongs whatever is in the heavens and whatever is in the earth).
2- “إِنَّا لِلَّهِ وَ إِنَّا إِلَیْهِ راجِعُون” (To Allah we belong, and unto Allah is our return).
3- “قُلْ لِمَنْ ما فِی السَّماواتِ وَ الْأَرْضِ قُلْ لِلَّه” (Say," To whom belongs whatever is in the heavens and the earth?" Say," To Allah).
On the other hand and from another point of view though, Allah has granted the people ownership of some of the things in this world, and has announced this in general and through certain categorizations.
In one place, He introduces Himself as such: “هُوَ الَّذی جَعَلَ لَکُمُ الْأَرْضَ ذَلُولاً فَامْشُوا فی مَناکِبِها وَ کُلُوا مِنْ رِزْقِهِ وَ إِلَیْهِ النُّشُور” (It is He who made the earth tractable for you; so walk on its flanks and eat of His provision, and towards Him is the resurrection).
In cases such as khums, inheritance, ownership, etc., also, it seems that the lord considers the people owners of a portion of the material world. It is clear that there is no difference and contradiction between these two points of view. The Quran has beautifully pointed to both of these viewpoints in one verse: “وَ سَخَّرَ لَکُمْ ما فِی السَّماواتِ وَ ما فِی الْأَرْضِ جَمیعاً مِنْهُ إِنَّ فی ذلِکَ لَآیاتٍ لِقَوْمٍ یَتَفَکَّرُون” (And He has disposed for you[r benefit] whatever is in the heavens and whatever is on the earth; all is from Him. There are indeed signs in that for a people who reflect).
Keeping the abovementioned points in mind, and even assuming that the terms ‘war spoils’ and ‘anfāl’ are equivalents of each other, it can be said that granting ownership to the fighters regarding the four fifths of the war spoils stems from the absolute ownership of the lord, and their ‘supposed’ ownership will in no way disturb His true ownership.