Bava Basra, Chapter 8, Mishnah 27. This is a wonderful Mishnah, as it emphasizes a principle that is not frequently found in the words of Chazal: the importance of preserving the beauty of Eretz Yisrael. Although we are dealing here with distancing objects, it is not the usual case of a neighbor causing damage to his fellow. The topic is maintaining an open space around the perimeter of the city.
The reason for the distancing:
According to the perspective of Chazal, towns are naturally crowded, and for the city to look beautiful, an empty space is required around its perimeter - spaciousness, fresh air, and clear light, which alleviate the feeling of overcrowding. Therefore, for aesthetic considerations, one may not plant trees too close to the city walls. While in our modern aesthetics we love trees, and Chazal also viewed them as something beautiful, they should not be planted at too close a distance to the city, as we want an open space to remain around it.
It is worth noting that in Tractate Arachin we learn that even fields are prohibited within a thousand amos of the city, but that is a completely different matter. Here we are dealing with trees adjacent to the city walls.
The aforementioned distancing applies specifically to the cities of Eretz Yisrael, by virtue of the mitzvah to beautify the Land of Israel, whereas the halachah is not so in cities outside of Eretz Yisrael.
The language of the Mishnah: "Marchikin es ha'ilan min ha'ir esrim vechamesh amah" - one must distance a tree from the city twenty-five amos:
"Esrim vechamesh amah" - twenty-five amos. This is the distance of the open and empty space that must be around the city's perimeter, about twelve meters.
"Uvacharuv uvashikmah chamishim amah" - and for a carob or a sycamore tree, fifty amos. Carob and sycamore trees are larger and less attractive, and therefore their contribution to the city's beauty is lesser, so they must be distanced a full fifty amos from the city boundary.
"Abba Shaul omer: kol ilan srak chamishim amah" - Abba Shaul says: any barren tree, fifty amos. Abba Shaul is more stringent: any tree that does not yield edible fruit, which is called a barren tree, must be distanced fifty amos from the edge of the city. The halachah is ruled in accordance with his view.
A tree that preceded the city:
"Ve'im ha'ilan kadam - kotzetz venosen damim" - if the tree preceded it, it is chopped down and money is given. If the tree was there first, for example, a person planted it legally and subsequently the city's area expanded until the tree was found to be within twenty-five amos, the tree is chopped down, but the city residents must compensate its owner from the city's tax funds, since he preceded them and is entitled to payment.
"Safek zeh kadam safek zeh kadam - kotzetz ve'eino nosen damim" - if there is a doubt which preceded which, it is chopped down and no money is given. When it is unknown which came first, whether the tree was planted permissibly outside the twenty-five amos and then the city expanded, or perhaps the city preceded it - we chop down the tree for certain, but its owner is not entitled to compensation for his loss, because the burden of proof is on the one seeking to extract money from his fellow: the burden of proof rests on him to prove that the money is owed to him, and without it, he has no power to obligate the city residents to pay.
In summary: In this Mishnah we learned about the obligation to distance trees from the city in Eretz Yisrael, which is not due to the reasons of neighborly damage but rather for the sake of the beauty of Eretz Yisrael and the appearance of the city: twenty-five amos for a regular tree, fifty amos for a carob and a sycamore, and according to the opinion of Abba Shaul - in accordance with which the halachah is ruled - fifty amos for any barren tree. We also discussed the law of a tree that preceded the city, that it is chopped down and money is given, and the case of doubt, where it is chopped down and money is not given by virtue of the rule "the burden of proof is on the one seeking to extract money from his fellow."