The Tribe of Levi was likewise not to receive a share of any plunder that might be won in battle during the conquest of the land of Israel. The Sifre clarifies the two referents in this verse, “a share” and “an inheritance” to refer to a share in the plunder and an inheritance in the land, respectively. Even though the kohanim were from the Tribe of Levi, the Torah reiterates these mitzvos separately for them, so there should be no mistake about the matter. (See Numbers 18:20.)
The basis of this mitzvah is that it is unseemly for the religious leaders to use things acquired in battle. Rather, they should exemplify a lifestyle of peace. Seriously, wouldn’t it just look wrong if your rabbi drove around in a drug dealer’s car that he bought at a police auction? Even more so, it would just feel off for those who worked in the Temple to stock their houses with things plundered from conquered nations.
This mitzvah applies to Levites in Temple times. In the Midrash, it is discussed in the Sifre. It is codified in the Mishneh Torah in the thirteenth chapter of Hilchos Shemittah. This mitzvah is #170 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.