Another interpretation of (Exodus 15:25) "And the LORD showed him a tree." And what was it? Rabbi Joshua says: it was an olive tree. Rabbi Nehemiah says: a tree of willow. And some say: the roots of a fig. And some say: the roots of a pomegranate, for there is nothing as bitter as these. And the Sages say: it was the harduphani tree, and there is nothing as bitter as it. Rabbi Ishmael the son of Rabbi Yohanan ben Beroka said: See how great are the miracles of the Holy One, blessed be He! Flesh and blood heal the bitter with the sweet, but the Holy One, blessed be He, heals the bitter with the bitter, as it is said (Jeremiah 30:17): "For [I will bring healing to you] and from your wounds I will heal you, says the LORD." With that by which He strikes, He heals. The Holy One, blessed be He, said to Moses that he should put a bitter thing into a bitter thing, in order to make it sweet thereby. Similarly it is written (II Kings 2:21): "And he went out to the spring of water, and cast salt there, and so on, and he said: Thus says the LORD, I have healed these waters." Similarly (Isaiah 38:21): "And Isaiah said: Let them take a cake of figs, and so on." And is it not so that when they place the sap of figs upon the flesh, immediately it is eaten away? Rather, it was in order to perform a miracle.
The Bitter Tree That Sweetened the Waters of Marah
Midrash Tanchuma Buber, Beshalach 18:2
ד"א ויורהו ה' עץ, ומה היה, ר' יהושע אומר, עץ זית היה, ר' נחמיה אומר עץ של ערבה, ויש אומרים עיקרי תאנה, ויש אומרים עיקרי רימון, שאין מרים כהם, וחכמים אומרים הרדופני עץ הוא, ואין מר כמוהו. אמר ר' ישמעאל בנו של ר' יוחנן בן ברוקה, ראה מה גדולים נסים של הקב"ה, בשר ודם במתוק מרפא את המר, אבל הקב"ה במר מרפא את המר, שנאמר כי [אעלה ארוכה לך] וממכותיך ארפאך נאום ה' (ירמי' ל יז), במה שהוא מכה הוא מרפא, אמר הקב"ה למשה שיתן דבר מר בתוך דבר מר למתוק בו, כיוצא בו כתיב ויצא אל מוצא המים וישלך שם מלח וגו', ויאמר כה אמר ה' רפאתי למים (מ"ב ב כא), כיוצא בו ויאמר ישעיהו ישאו דבלת תאנים וגו' (ישעי' לח כא), והלא בזמן שנותנים שרף של תאנים על הבשר מיד הוא מתאכל, אלא כדי לעשות נס.