Assuming that the neighbor is right--and you do not need to take  him at his word, if you think he is wrong; you can and should have the property resurveyed--then you would be responsible for the cost of tearing it down; the current property owner has to correct any encroachments. However, you may in turn have grounds to seek compensation from the person who sold the property to you, if the deck was misrepresented as being legal. The borough is not liable even if they issued permits; they rely on the papers provided to them by the permitting homeowner, and do not go out and resurvey or double check that the boundaries, etc. are correct.