Divrei HaYamim (I 7:20-22) tells of a battle between the inhabitants of Gas, which we know was a Plishti stronghold, and the children of Ephraim. The pasuk uses two ambiguous phrases in describing who was fighting and what caused the war: 1) “Hanoladim ba’aretz,” who were born in the land – Rashi and others explain that the inhabitants of Gas were familiar with the land, since it was their place of birth, and were able to therefore ambush the descendants of Ephraim who were newcomers. Radak explains that the phrase refers to the Bnei Ephraim, as we will explain. 2) “Ki yardu lakachas es mikneihem,” because they were down to take their cattle -- it’s unclear whether the people of Gas took the cattle from the bnei Ephraim, or vica versa. As a result of the deaths of his children, Ephraim suffered inconsolable grief, and his brothers were unable to comfort him (the pasuk echoes the phrase used with respect to Ya’akov Avinu’s mourning for Yosef).
When did this story take place? We know from the end of the Sefer Braishis that Yosef had grandchildren, i.e. descendants of Ephraim, who were born in Egypt. Radak writes that the Navi therefore tells us that this episode did not happen to those children of Ephraim born in Egypt, but rather to others, “ha’noladim ba’aretz.” Yet, it cannot be referring to Bnei Ephraim born in Eretz Yisrael, as the simple reading of “noladim ba’aretz” suggests, as that would mean that Ephraim himself entered Eretz Yisrael, and we know that with the exception of Yehoshua and Kalev, no one who left Egypt entered Eretz Yisrael. Therefore, writes Radak, it must refer to some episode that happened while Bnei Yisrael were travelling in the midbar. This would mean that Ephraim himself was one of those that left Egypt, which is incredible in itself.
The Da’at Mikra quotes from the interpretation of R”Y HaChassid on Sefer Shmos that describes how the shevatim maintained what sounds like feudal estates in Eretz Yisrael even after they had already gone down to Mitzrayim. The residents of Gas and others farmed the land in Eretz Yisrael and paid taxes to the shevatim. This was what led Pharoah to worry “v’nosaf gam hu al sonainu v’nilcham banu,” that there would be a cross-border war and Bnei Yisrael would side with the enemy since their property and investments were still tied up in Eretz Yisrael, not in Egypt. The servitude started when Pharoah forced the taxes paid to the shevatim to be diverted to his own treasury.
Chazal (Sanhedrin 91, also in the targum to Divrei haYamaim) have a different view than Radak, and this brings us back to the pasuk in Beshalach. Chazal teach that a contingent of the Bnei Ephraim miscalculated the duration of galus by 30 years and tried to escape from Mitzrayim early. They made their way to Eretz Yisrael where they were cut down in battle by the people of Gas. When we read in Parshas Beshalach that “no nacham Elokim derech Eretz Plishtim… ki amar Elokim pen yinachem ha’am birosam milchacma,” it does not mean that G-d did not lead Bnei Yisrael through Plishti territory lest they turn back rather than face the Plishtim in battle. After all (as many meforshim ask), the people were able to face Amalek in battle – why not the Plishtim? What the pasuk means is that when the people would see the war that had occurred in the past, i.e. the graves and remains of the Bnei Ephraim who had fought the Plishtim and suffered a horrendous loss, then they would lose heart and want to turn back.
On a final note, the Taz in Parshas Va’eira asks a question that is perplexing. Rashi (6:16) writes that the shibud Mitzrayim did not take effect so long as so long as one of the shevatim was alive. If so, how could Ephraim have still been alive during the galus? He answers that Ephraim prophetically saw what would happen and mourned long before the events actually occurred. My wife suggested a much simpler answer: when Chazal say the shevatim died before the galus started, they mean Yosef and his brothers, not Ephraim and Menashe. Rashi cites the pasuk of “Vayamas Yosef v’kol echav,” which clearly refers to Yosef himself.