The Gemara (23b) considers the Korbanot that Balak offered as a Mitzvah she'Lo l'Shmah.
Tosfos DH she'Mitoch (the first one) states that only a Mitzvah that is performed for self-aggrandizement has the merit of a Mitzvah she'Lo l'Shmah, but an act intended to hurt others is considered l'Kanter and is undesirable.
Balak brought the offerings to be able to harm Klal Yisroel.
How does Tosfos' Tirutz reconcile with the Gemara, Balak's Korbanot were offered l'Kanter ?
Mordechai Schwimmer, Brooklyn, USA
We addressed this issue in the Insights. Here is what we wrote on it:
3) THE MERIT OF DOING A MITZVAH "SHE'LO LISHMAH"
QUESTION: Rav Yehudah in the name of Rav teaches that a person should always engage himself in the study of Torah and the fulfillment of Mitzvos, even if his motives are insincere ("she'Lo Lishmah"), because by practicing these acts, even though it is with ulterior motives, one will eventually practice them through sincere motivation ("Lishmah"). This precept is learned from Balak, who offered 42 sacrifices to Hash-m with intention of endearing Hash-m to help him destroy the Jewish people. In return for his Mitzvah "she'Lo Lishmah," Balak merited to have Ruth among his descendants (see next Insight). (The MEFARESH refers to the Gemara in Berachos (7b) that says that her name was "Ruth" because she had a great-grandson, David ha'Melech, "who satisfied (she'Rivahu) Hash-m with songs and praises," which was the ultimate involvement in serving Hash-m "Lishmah.")
TOSFOS (DH she'Mitoch) questions this from the Gemara in Berachos (17a) that says that "one who is involved in a Mitzvah for insincere motives is better off having not been created." Tosfos answers that the Gemara in Berachos refers to one who does a Mitzvah with intention to undermine or persecute others, while here the Gemara refers to one who does a Mitzvah just to gain honor or a good reputation.
The SEFAS EMES asks that according to this distinction, what is the Gemara's proof from Balak that one who engages in Torah and Mitzvos "she'Lo Lishmah" will eventually come to do it "Lishmah?" In the case of Balak, his offering of sacrifices to Hash-m was clearly for the sake of destroying the Jewish people, and it was not just for the insincere motive of personal honor! How, then, can the Gemara prove from there that "she'Lo Lishmah" leads to "Lishmah," if Balak's form of "she'Lo Lishmah" was the type for which the Gemara in Berachos says that the person "is better off having not been created?"
ANSWER: When Tosfos says that learning Torah or doing Mitzvos in order to persecute others is bad, he means that the person has the sole intention of doing the Mitzvah in order to undermine someone else through this action which happens to be a Mitzvah. The person does not intend to do the will of Hash-m at all. Balak, on the other hand, had genuine intent to do the Mitzvah in order to gain favor in the eyes of Hash-m. Even though his final goal was to gain favor in the eyes of Hash-m in order to bring about the downfall of the Jewish people, his immediate goal was to gain favor, which is an acceptable form of "she'Lo Lishmah."
This might be why the result of Balak's Mitzvah "she'Lo Lishmah" was a "Lishmah" that happened only after many generations passed, when Ruth was born. Since his Mitzvah "she'Lo Lishmah" was not done simply to gain honor but also included the ultimate goal of gaining honor in order to cause someone else's downfall, the merit of that Mitzvah "she'Lo Lishmah" did not come in his lifetime. In contrast, when a person is involved in a Mitzvah "she'Lo Lishmah" only for his own personal benefit, then he merits, personally, to be involved in a Mitzvah "Lishmah."