In working buying a home with an existing fence, or buying a fence, the need for a good boundary survey can not be overstated.
In the legal profession, there's a saying: "Good fences, good neighbors make; bad fences, bad neighbors make."
My education in this area came from a real estate transaction years ago where I was representing an attorney. I had experiences with fences extending over the property line, but this fence was 4' inside the property line. Surely there could be no problem with that! But there was. My client described 'adverse possession' and started to send me page after page of case law regarding the subject.
What I learned then was that if a fence is 10 years old and it was improperly placed inside the property lines, such that the neighbor was performing maintenance on a section of property, that the neighbor had the right to make a claim for that section of land. This legal term was referred to squatters rights, or adverse possession. In order to validate the claim, one would have to seek counsel, file a suit to quiet title.
To prevent this from happening, particularly if a person is just buying a home where the risk of this is happening, legal assistance is important. Sometimes the counsel from the title company can assist in preparing quit claim deeds to the neighbors so that their apparent right is mitigated.
From our point of view, the important thing is to get a survey, so that this isn't something that blindsides you later!