“And if you err, and don’t do all of these commandments that G-d spoke to Moshe” (Bamidbar 15:22). Rashi tells us that only one commandment is being referred to here, worshipping other deities; it is described as “all of these commandments” because worshipping a deity other than the Creator is the equivalent of transgressing every commandment. He then explains the words “that G-d spoke to Moshe” by quoting the Talmud (Horiyos 8a), which says the first two of the Ten Commandments were heard by the entire nation directly from G-d (as opposed to the other eight of the Ten Commandments, which we couldn’t undrstand so needed Moshe to decipher for us, as well as the other 603 biblical commandments, which G-d told to Moshe, who relayed them to us. But how could the words “that G-d spoke to Moshe” refer specifically to something that G-d spoke to all of us, not just Moshe? Shouldn’t this commandment be described as having been “spoken” or “commanded” to “you” rather than to Moshe? How can commandments “spoken to Moshe” refer exclusively (and it is exclusively, since the offerings differ if other commandments are violated) to commandments that weren’t spoken only to Moshe?
Several commentators address this issue, with mixed results. Bartenura understands Rashi’s comment to mean that the expression “that G-d spoke to Moshe” specifically excludes worshipping idols, since the first two of the Ten Commandments were heard by the entire nation (and were not spoken just to Moshe). Aside from the implication of Rashi’s wording being that these words refer specifically to idol worship (and not to everything but idol worship), and aside from the context of the Talmud (and how Rashi explains it, which we will get to shortly) contradicting this, many of the details of idol worship did come through Moshe. It is also a bit awkward for a verse that is referring specifically to idol worship to use an expression that purposely excludes it.
The L’vush presents a similar explanation, with the comparison being between idol worship (which is not referred to by any terms in the verse) and the other 611 commandments, which G-d spoke only to Moshe (and what the verse is referring to; the trangression this process is applied to is idol worship based on it being the equivalent of all the other commandments). Rebbe Yaakov K’nizel takes it a step further, saying that idol worship cannot be said to be equal to all the commandments of the Torah, since it is one of them, and putting idol worship on one side of the scale and all 613 commandments on the other side cannot balance (i.e. cannot be called equivalent) unless none of the other commandments carry any weight (which is obviously not true). Therefore, in order to compare idol worship with “all the commandments of the Torah,” the commandment not to worship idols must be excluded from that side of the scale. In order to indicate that idol worship is not part of “all these commandments,” they are described as “commandments that G-d spoke to Moshe,” which would exclude idol worship (since we heard that directly from G-d). Besides the issues raised above, we can add that it is obvious that comparing any one commandment to “all the commandments” must mean “besides counting this one on both sides of the ledger,” and there should be no need to point it out. Additionally, there are several commandments said to be “equal to all the commandments,” such as Shabbos, Tzitzis and circumcision, making the statement a literal impossibility. [How can Shabbos plus everything else weigh the same as idol worship if idol worship plus everything else weighs the same as Shabbos? Add others that are “equal to all the commandments” to the mix and this impossibility becomes, um, more impossible (which itself is impossible!).] Rather, the expression is meant figuratively, showing how important each of these commandments are, and there is therefore no need to exclude the commandment under discussion from being included in “all the commandments.”
Rebbe Sh’muel El-Moshnenu suggests that the expression “that G-d spoke to Moshe” means “only to Moshe, without being intended to be repeated to us” (especially when contrasted with the next verse, which mentions “all that G-d commanded you through Moshe”). Since every commandment taught to Moshe was supposed to be repeated to us, the only thing this expression could possibly refer to is something that Moshe didn’t need to repeat to us because we heard it from G-d ourselves, i.e. the first two of the Ten Commandments. However, Moshe did repeat those to us as well (when he repeated the Ten Commandments in Sefer D’varim), besides constantly warning us against idol worship. This would also mean that the “commandments” referred to in 15:22 are not the same as those referred to in 15:23, even though both are the “commandments” whose transgression triggers the offerings subsequently described.
The Talmud contrasts the commandments “that G-d spoke” (15:22) which implies our hearing it directly from G-d, with the opening words of the next verse, “all that G-d commanded you through Moshe,” with the only commandments given through G-d’s direct speech (the first two of the Ten Commandments) and also by Moshe relaying it to us (i.e. Sh’mos 34:14 ) being about idol worship. It is clear that the point of the Talmud, which Rashi is using in his commentary on Chumash to explain what “that G-d spoke to Moshe” refers to, is that we heard the commandment not to worship idols directly from G-d (as opposed to referring to every commandment but those). As far as why it is described as G-d having “spoken with Moshe” if we all heard it, Rashi (on the Talmud) says that G-d was speaking to Moshe, but we were able to hear what G-d was saying to him.
Although this explains how the commandments we heard directly from G-d can be described as being “spoken to Moshe,” it doesn’t explain why G-d directed His speech to Moshe if the intended audience was much wider. Maharal (Gur Aryeh) and Maskil L’Dovid (on Rashi’s commentary on Chumash) reference the Midrash (Bamidbar Rabbah 19:33, see Rashi on Sh’mos 20:2) that says the reason the Ten Commandments were said in singular form is to enable Moshe to defend the nation after the sin of the golden calf by pointing out that only he was told not to worship idols. Which means that these commandments were, in a sense, only said to Moshe, even if they were said loudly and clearly enough for the entire nation to (over)hear. Nevertheless, despite it being technically accurate that they were “spoken to Moshe,” it still seems a bit out of place to highlight this technicality if the point is that we heard them directly from G-d rather than being relayed to us by Moshe.
The Talmud brings a couple of ways we know the transgression being discussed here is idol worship, with the contrast between “spoken by G-d to Moshe” (Bamidbar 15:22) and “G-d commanded us through Moshe” (15:23) being the second. Rashi paraphrases the first in his previous comment (actually, he is quoting Sifre 111, but the “proof” is similar, while being dissimilar enough to make us aware that he is using multiple sources), so his point regarding which commandments were “spoken to Moshe” cannot be to prove that the transgression under discussion is idol worship. [This is borne out by Rashi ignoring the contrast between 15:22 and 15:23.] Instead, Rashi is highlighting the fact that we heard the prohibition against idol worship directly from G-d. But why does this make a difference? Is the transgression (which, in this case, was not done purposely) more severe because we heard it directly from G-d, or less severe, because G-d purposely didn’t say it to us, but to Moshe?
Being that Moshe reiterated the severity of the sin of idol worship numerous times, there is no doubt that it fully applies to everyone, not just to Moshe. Nevertheless, in the situations under discussion, where the sin was not committed purposely, since there was already a precedent set (by directing the Ten Commandments to Moshe) that G-d will, to some extent, try to lessen the impact of idol worship so that we can more easily return to Him, it might cross our minds that exculpation is not really important. Therefore, the Torah highlights the fact that even though the Ten Commandment were “spoken to Moshe” so that he can present a defense for the nation’s sin, these offerings must be brought in order to achieve forgiveness. “And if you err, and don’t keep the commandments that you heard G-d Himself say, that were purposely spoken to Moshe and not directed towards you” (15:22), “commandments that Moshe clearly and continually told you apply to you now and forever” (15:23), here is the process to achieve forgiveness (15:24-28).