Ask my colleague about this and the common sense according to him is:
1. If the fence is in your neighbor's property, you are not allowed to attach your gate to your neighbor's fence post.
2. If the fence is on the property line, no matter who paid for it when it was first built, the fence itself is shared by you and your neighbor, meaning that you are allowed to attach your gate to the fence post. And generally you should not be asked to share the cost for building the fence, which was done before you moved in.