Bamidbar31:21

וַיֹּאמֶר אֶלְעָזָר הַכֹּהֵן אֶל־אַנְשֵׁי הַצָּבָא הַבָּאִים לַמִּלְחָמָה זֹאת חֻקַּת הַתּוֹרָה אֲשֶׁר־צִוָּה יְהוָה אֶת־מֹשֶׁה׃

And Elazar the kohen said to the men of war who went to the battle: "This is the statute of the Torah which the Eternal commanded Moshe:

Bamidbar 31:21

וַיֹּאמֶר אֶלְעָזָר הַכֹּהֵן

Bamidbar / Numbers 31:21 · Pshat

Bamidbar 31:21

וַיֹּאמֶר אֶלְעָזָר הַכֹּהֵן אֶל־אַנְשֵׁי הַצָּבָא הַבָּאִים לַמִּלְחָמָה זֹאת חֻקַּת הַתּוֹרָה אֲשֶׁר־צִוָּה יְהוָה אֶת־מֹשֶׁה׃

And Elazar the kohen said to the men of war who went to the battle: "This is the statute of the Torah which the Eternal commanded Moshe:

Pshat פְּשָׁט

Why Elazar spoke

The teacher is present, yet his student explains the law. That is not the usual way. The commentators ask why the laws of purging vessels after the war are said by Elazar (Eleazar) and not by Moshe (Moses).

Rashi: Moshe (Moses) grew angry at the officers, and anger leads to error, so the laws of purging vessels were hidden from him. Chizkuni: the laws of the red heifer were given through Elazar (Eleazar), so he explained them, but for saying a law before his teacher he was punished. Sforno: "the statute of the Torah" is the law of the red heifer, purification on the third and seventh day.

How Rashi, Chizkuni, and Sforno explain it

Rashi And Elazar the kohen said, etc

Because Moshe (Moses) came to anger, he came to error: the laws of purging the vessels of gentiles were hidden from him. And so you find on the eighth day of the inauguration, as it says: "And he was angry with Elazar (Eleazar) and with Itamar (Ithamar)" (Vayikra / Leviticus 10:16): he came to anger, he came to error. And so too: "Hear now, you rebels", and he struck the rock (Bamidbar / Numbers 20:10–11): through anger he erred.

Chizkuni And Elazar the kohen said

Since the statute of the red heifer was given through Elazar (Eleazar), he explained it to Israel. But since he taught a law before Moshe (Moses) his teacher, even though he said it in the name of Moshe his teacher, he was punished. For it is written: "And he shall stand before Elazar the kohen" (Bamidbar / Numbers 27:21), yet we do not find afterward that Yehoshua (Joshua) needed him.

Sforno This is the statute of the Torah

What Moshe (Moses) told you, that you should purify yourselves on the third and the seventh day, is the very statute of the Torah of the red heifer: to purify from the impurity of the dead.

Takeaway

The eighth day of the Tabernacle's inauguration: Moshe was angry with the sons of Aharon for not eating the sin offering (Vayikra / Leviticus 10:16–20).
At the waters of Merivah Moshe struck the rock instead of speaking to it (Bamidbar / Numbers 20:7–12).
The law of the red heifer (פָּרָה אֲדֻמָּה) opens with the same words, "this is the statute of the Torah" (Bamidbar / Numbers 19:2).