Yoma 39a quotes the statement of Rav Hoshaya that when Shlomo built the Beis HaMikdash, he planted within it a miraculous tree which produced miraculous fruit. (The Gemara earlier, 21b, quotes this as well.)
Isn't this a violation of Lo Sita Lecha Asherah Kol Eitz etc. (Devarim 16:21)?
Rashi (Devarim ibid.) says it is prohibited to plant a tree anywhere in Har HaBayis! So where could Shlomo have planted this tree without violating this prohibition?
Yaakov Abramovitz, Flushing
The Sfas Emes (Yuma 39) says that the tree was not made of wood but rather of gold and the Torah's prohibition only refers to wood and not to other substances. This is explicitly stated in the Torah which after the word Asheirah adds Kol Etz meaning that only wooden trees are included (Lehoros Nassan 2:33)
Moreover this was no physical planting but a miraculous growth and that is not considered an Asheirah which is a natural form of planting. (Lehoros Nassan quotes Yaavetz who claims that in one region the grapes have gold growing with them but an entire tree of gold is clearly miraculous and would not be included in the Torah's prohibition.
The Maharal says that the Beis Mikdash is the center of the world's growth and sustenance and therefore gold which is a special measure of sustenance can grow from within the Beis Hamikdash.