And his words are very puzzling; how can he say that there was no error in the essence of the blessing? Behold, it is entirely an error since he concluded with a different blessing, and the essence of the blessing is the end. For if a person were to say only: "Blessed are You, Hashem, our God, King of the universe" and no more, is it called a blessing? Behold, this is nothing but taking the Name of Heaven in vain, and the early authorities have already challenged him. And according to my humble opinion, it appears that the Rambam said as follows, and he follows his own reasoning in chapter 1, that regarding all blessings, one fulfills the obligation through contemplation in the heart alone, see there. And according to this, he spoke well: "That at the time he mentioned the Name and the Kingship, which are the essence of the blessing, he intended only for the appropriate blessing etc.," meaning that since at the time of saying the Name and the Kingship it was in his heart to say it properly, behold it is as if he completed the blessing in his heart and fulfilled the obligation. And if so, what do we care what he concluded with his mouth improperly, since he already fulfilled the obligation through the contemplation of the heart. (And as for why regarding the blessings of the recitation of the Shema we follow only after the signature, as he himself wrote in chapter 1 of the Laws of the Recitation of the Shema, this is because they are very long and it is not relevant that he intended the entire appropriate text in his heart, as is understood; which is not the case with the blessings of enjoyment which are short. And the Kesef Mishneh there and the Lechem Mishneh here and several of the commentators have already elaborated, as well as in his responsa to the scholars of Lunel who were puzzled, and in my humble opinion according to what I have written, this is the most correct way to settle his words, and delve into it).
ודבריו תמוהים עד מאוד, איך קאמר שלא היה בעיקר הברכה טעות, הלא כולה טעות כיון שסיים בברכה אחרת, והרי עיקר הברכה היא הסוף. וכי אם יאמר אדם רק: 'ברוך אתה ה' אלהינו מלך העולם' ולא יותר מקרי ברכה, והרי אין זה רק שם שמים לבטלה, וכבר השיגוהו הקדמונים. ולפי עניות דעתי נראה דהרמב"ם הכי קאמר, והולך לשיטתו בפרק א' דכל הברכות יוצאין בהרהור בלב בלבד ע"ש, ולפי זה שפיר קאמר: "שבשעה שהזכיר את השם והמלכות שהן עיקר הברכה לא נתכוין אלא לברכה הראויה וכו”,' כלומר כיון דבשעת אמירת השם והמלכות היה בלבו לומר כהוגן, והרי הוא כאלו גמר הברכה בלבו ויצא, ואם כן מה איכפת לנו מה שסיים בפיו שלא כהוגן כיון שכבר יצא בהרהור הלב. (ומה שבברכות קריאת שמע הולכין רק אחר החתימה כמ"ש בעצמו בפרק א' מק"ש זהו מפני שהן ארוכות הרבה ולא שייך שכיון כל הנוסח הראוי בלבו כמובן, מה שאין כן ברכת הנהנין שהן קצרות, וכבר האריכו הכ"מ שם והלח"מ בכאן וכמה מהמפרשים ובתשובתו לחכמי לוני"ל התמוהים, ולעניות דעתי כפי מ"ש זהו הדרך היותר נכון ליישב דבריו ודו"ק).