וּפְלִיגָא דְּרַבִּי פְּדָת: דְּאָמַר רַבִּי פְּדָת לֹא אָסְרָה תּוֹרָה אֶלָּא קוּרְבָה שֶׁל גִּלּוּי עֲרָיוֹת בִּלְבַד, שֶׁנֶּאֱמַר: ״אִישׁ אִישׁ אֶל כׇּל שְׁאֵר בְּשָׂרוֹ לֹא תִקְרְבוּ לְגַלּוֹת עֶרְוָה״. עוּלָּא כִּי הָוֵי אָתֵי מִבֵּי רַב הֲוָה מְנַשֵּׁק לְהוּ לְאַחְווֹתֵיהּ אַבֵּי חָדַיְיהוּ, וְאָמְרִי לַהּ אַבֵּי יְדַיְיהוּ. וּפְלִיגָא דִידֵיהּ אַדִּידֵיהּ, דְּאָמַר עוּלָּא: אֲפִילּוּ שׁוּם קוּרְבָה אָסוּר, מִשּׁוּם ״לֵךְ לְךָ אָמְרִי נְזִירָא סְחוֹר סְחוֹר, לְכַרְמָא לָא תִּקְרַב״. תָּנֵי דְּבֵי אֵלִיָּהוּ: מַעֲשֶׂה בְּתַלְמִיד אֶחָד שֶׁשָּׁנָה הַרְבֵּה, וְקָרָא הַרְבֵּה, וְשִׁימֵּשׁ תַּלְמִידֵי חֲכָמִים הַרְבֵּה, וּמֵת בַּחֲצִי יָמָיו. וְהָיְתָה אִשְׁתּוֹ נוֹטֶלֶת תְּפִילָּיו וּמְחַזַּרְתָּם בְּבָתֵּי כְנֵסִיּוֹת וּבְבָתֵּי מִדְרָשׁוֹת, וְאָמְרָה לָהֶם: כָּתוּב בַּתּוֹרָה ״כִּי הוּא חַיֶּיךָ וְאוֹרֶךְ יָמֶיךָ״, בַּעֲלִי שֶׁשָּׁנָה הַרְבֵּה וְקָרָא הַרְבֵּה וְשִׁימֵּשׁ תַּלְמִידֵי חֲכָמִים הַרְבֵּה, מִפְּנֵי מָה מֵת בַּחֲצִי יָמָיו? וְלֹא הָיָה אָדָם מַחְזִירָהּ דָּבָר. פַּעַם אַחַת נִתְאָרַחְתִּי אֶצְלָהּ וְהָיְתָה מְסִיחָה כׇּל אוֹתוֹ מְאוֹרָע. וְאָמַרְתִּי לָהּ: בִּתִּי, בִּימֵי נִדּוּתֵךְ מַה הוּא אֶצְלֵךְ? אָמְרָה לִי: חַס וְשָׁלוֹם, אֲפִילּוּ בְּאֶצְבַּע קְטַנָּה לֹא נָגַע [בִּי]. בִּימֵי לִבּוּנִיךָ מַהוּ אֶצְלֵךְ? אָכַל עִמִּי וְשָׁתָה עִמִּי וְיָשַׁן עִמִּי בְּקֵירוּב בָּשָׂר, וְלֹא עָלְתָה דַּעְתּוֹ עַל דָּבָר אַחֵר. וְאָמַרְתִּי לָהּ: בָּרוּךְ הַמָּקוֹם שֶׁהֲרָגוֹ, שֶׁלֹּא נָשָׂא פָּנִים לַתּוֹרָה. שֶׁהֲרֵי אָמְרָה תּוֹרָה: ״וְאֶל אִשָּׁה בְּנִדַּת טוּמְאָתָהּ לֹא תִקְרַב״. כִּי אֲתָא רַב דִּימִי, אָמַר: מִטָּה חֲדָא הֲוַאי. בְּמַעְרְבָא אָמְרִי: אָמַר רַב יִצְחָק בַּר יוֹסֵף, סִינָר מַפְסִיק בֵּינוֹ לְבֵינָהּ.
Rabbi Pedat said: The Torah only prohibited intimacy that involves engaging in prohibited sexual relations, as it is stated: “None of you shall approach to any that is near of kin to him, to uncover their nakedness” (Leviticus 18:6). The Gemara relates that Ulla, when he would come from the house of his teacher, would kiss his sisters on their chests. And some say: On their hands. Ulla was not concerned about violating the prohibition of displaying affection toward a relative forbidden to him, as his intention was not to have relations with them. The Gemara adds that his action was in contradiction to a saying of his, as Ulla said: Even any intimacy is prohibited with a woman with whom he is forbidden to engage in sexual relations due to the reason formulated as an adage: Go around, go around, and do not approach the vineyard, they say to the nazirite. They advise the nazirite, who is forbidden to consume any product of a vine, that he should not even approach the vineyard. The same is true with regard to the prohibition of forbidden relations. According to Ulla, one must distance himself to whatever degree possible.
The Sage in the school of Eliyahu taught a baraita that deals with this halakha: There was an incident involving one student who studied much Mishna and read much Bible, and served Torah scholars extensively, studying Torah from them, and, nevertheless, died at half his days, half his life expectancy. His wife in her bitterness would take his Tefillin and go around with them to synagogues and study halls, and she said to the Sages: It is written in the Torah: “For it is your life and the length of your days” (Deuteronomy 30:20). If so, my husband who studied much Mishna, and read much Bible, and served Torah scholars extensively, why did he die at half his days? No one would respond to her astonishment at all.
Eliyahu said: One time I was a guest in her house, and she was relating that entire event with regard to the death of her husband. And I said to her: My daughter, during your period how did he act toward you? She said to me: Heaven forbid, he did not touch me even with his little finger. And I asked her: In the days of your white garments, after the menstrual flow ended, and you were just counting clean days, how did he act toward you then? She said to me: He ate with me, and drank with me, and slept with me with bodily contact, however, it did not enter his mind about something else, i.e., conjugal relations. And I said to her: Blessed is the Omnipresent who killed him for this sin, as your husband did not show respect to the Torah. The Torah said: “And to a woman in the separation of her impurity you should not approach” (Leviticus 18:19), even mere affectionate contact is prohibited.
(א) כָּל הַבָּא עַל עֶרְוָה מִן הָעֲרָיוֹת דֶּרֶךְ אֵיבָרִים אוֹ שֶׁחִבֵּק וְנִשֵּׁק דֶּרֶךְ תַּאֲוָה וְנֶהֱנָה בְּקֵרוּב בָּשָׂר הֲרֵי זֶה לוֹקֶה מִן הַתּוֹרָה. שֶׁנֶּאֱמַר (ויקרא יח ל) "לְבִלְתִּי עֲשׂוֹת מֵחֻקּוֹת הַתּוֹעֵבֹת" וְגוֹ'. וְנֶאֱמַר (ויקרא יח ו) "לֹא תִקְרְבוּ לְגַלּוֹת עֶרְוָה". כְּלוֹמַר לֹא תִּקְרְבוּ לִדְבָרִים הַמְּבִיאִין לִידֵי גִּלּוּי עֶרְוָה:
(1) Anyone who sleeps with one of the forbidden relationships "by way of limbs", or who hugs and kisses in a sexual way and takes pleasure in physical intimacy, receives lashes for a d'Oraisa transgression, as it says (Leviticus 18:30) "do not do any of these abominable customs etc" and it says (Leviticus 18:6) "do not approach to uncover nakedness", which is to say do not approach things which will bring you to transgressing the strongest prohibitions.
(א)... והנה הרב מצא הברייתא הזו המפורשת ותלה דבריו באילן גדול אבל כפי העיון בתלמוד אין הדבר כן שיהיה בקריבה שאין בה גלוי ערוה כגון חבוק ונשוק לאו ומלקות שהרי בגמרת שבת (דף י"ג) שאלו בנדה אם מותר שישכב בעלה עמה במטה אחת היא בבגדה והוא בבגדו והיו מהם מי שאסר והעלו ופליגא דרבי פדת דאמר רבי פדת לא אסרה תורה אלא קריבה של גלוי עריות שנאמר איש איש אל כל שאר בשרו לא תקרבו לגלות ערוה,...נבין מהם כי אצלם זה האיסור מדרבנן או יהיה מן התורה דכל דמתהני מאיסורא אסורה כענין בחצי שיעור, אבל אין זה עיקר מדרש בלאו הזה אלא קרא אסמכתא בעלמא והרבה מאד כן בספרא ובספרי
The Rambam found an explicit baraita, and hung his words on the limbs of a strong tree, but according to the explicit conclusion of the Talmud it is not the case that "closeness" that does not include within it sexual contact, like hugging and kissing, constitutes a biblical prohibition for which a person would receive lashes. It even says in the Talmud in Masechet Shabbat 13a that the rabbis were asked whether a man and woman could sleep in the same bed, each wearing clothes, and there were those who permitted and those who prohibited it. And we can understand that even the rabbis who prohibited this felt that it was only a rabbinic prohibition, not an explicit Torah prohibition.
(א) באיזו ביאה חייב הבא על הערוה ובו ב סעיפים: הבא על אחת מן העריות דרך איברים או שחבק ונשק ונהנה בקירוב בשר הרי זה לוקה וחשוד על העריות:
(1) If one has bodily contact with one of the arayot (people with whom sexual relations are forbidden), or he hugged and kissed and benefited from nearness of the flesh, he receives (biblically sanctioned) lashes, and in suspected of having relations with arayot.
נראה לי מהך עובדא דהעלה לבו טינא ומכל מקום משמע דאף הרמב"ם לא קאמר אלא כשעושה חיבוק ונישוק דרך חיבת ביאה שהרי מצינו בש"ס בכמה דוכתי שהאמוראים היו מחבקים ומנשקים לבנותיהם ואחיותיהם ...וכן משמע להדיא ממ"ש הרמב"ם ר"פ כ"א מהל' א"ב וז"ל כל הבא על העריות דרך אברים או שחבק ונשק דרך תאוה ונהנה בקירוב בשר ה"ז לוקה מן התורה כו' וכן כתב הסמ"ג והכתר תורה שם אלמא דאינו לוקה אלא בדרך תאוה וחיבת ביאה
It seems to me that this is referring specifically to a case in which passion rose in his heart, but nevertheless even in such a case it appears that even the Rambam doesn't go this far. The Rambam seems to say that only hugging and kissing that is done in a sexual manner is forbidden, as we read in the Talmud about rabbis who would hug and kiss their daughters and sisters. The Rambam only states that a person "taking pleasure" in this hugging and kissing, and benefitting from the close contact, is lashed at a Torah level, and other contemporaries of his disagree and say there is no Torah prohibition even in this act.