The Mishnah teaches that hills that are worshipped do not become forbidden to Jews, although what is on those hills may become forbidden. The passage that is the source for this prohibition appears in Sefer Devarim (7:25) where the Torahforbids the gold and silver that are on them, but the ground itself cannot become forbidden.
One exception mentioned by the Mishnah is the Asherah tree, which, although it is part-and-parcel of the land, nevertheless has been fashioned, in a sense, by human activity, since it was planted.
The idea that a natural formation like a hill or a valley might be worshipped as a god is a concept that exists back to prehistoric times, when pagans actually worshipped such things and sacrificed to them. One very early example of this was the cult of Ba’al Hermon that worshipped Mount Hermon, and whose cultic activities lasted into Mishnaic times. Occasionally the cult would worship an idol or statue that was related to the geographic place, while in other cases the worship would be focused on the place itself, like Mount Carmel, which was worshipped with no associated idol.
According to Rashi, the reason that we distinguish between the hills and what is on the hills is because in their natural form the hills cannot possibly become avodah zarah. What is on them, however, becomes forbidden because of the aforementioned passage in Sefer Devarim. Pagans who worship the hills, however, will still be punished because of their intention to perform avodah zarah. Rabbenu Tam offers an alternative approach, arguing that the hills will be considered avodah zarah, which is why those people worshipping them will be punished for doing so. The rule taught by the Mishnah is that although the hills are considered avodah zarah, they do not become forbidden.