The Sermon at the Temple can—and should—be understood at several different levels:
How do we explain the close parallel between the Sermon on the Mount in the New Testament and the Sermon at the Temple in 3 Nephi? This question is often asked, especially as biblical scholars have more and more come to the conclusion that Matthew simply put the Sermon on the Mount together long after Jesus’ death, resurrection, and ministry. They consider that it could have been compiled as long as 20–40 years after Jesus had died. People, they think, had been collecting its saying in what we might call scrapbooks. That view of the Sermon on the Mount is certainly incompatible with the fact that Jesus, shortly after his resurrection, appeared in Bountiful and gave essentially the same text. In actuality, He may have given this speech many times, altered to suit the needs of each particular audience (see, for example, the Sermon on the Plain, in Luke 6). In an important way, the “sermon” in 3 Nephi begins in 3 Nephi 11 and goes to the end of chapter 18, where Jesus gives everyone the sacrament, and places them under covenant to keep the commandments which he has just given them. Seeing it in that context helps unfold the covenant-making nature of this text.
John W. Welch, Illuminating the Sermon at the Temple and the Sermon on the Mount (Provo, UT: FARMS, 1999), chapters 4 and 5.