In some cases, offering further contact can be OK. However, such offers can easily meet the Stack Exchange definition of spam:
- Is it promoting a product or service? Yes, in the widest sense - regardless of whether there's a profit motive.
- Is the offer unsolicited or lacks disclosure of affiliation? Yes, the offer is unsolicited. When the contact offer is irrelevant to the subject being discussed, I'd treat it as unsolicited.
(But these answers also tend to contain lots of links that promote a project without disclosing the author's affiliation, which might be a kind of spam by itself.)
I think offering contact can be OK if
- this is done extremely rarely;
- the offer is meaningfully related to the question (the offer is helpful); and
- the ensuing discussion would not be of interest to the community.
For example, a person who wants to start contributing to an open source project asks about community conventions regarding such contributions. The question is not specific to a project, but clearly relates to a particular project. One of the maintainers of that project sees the question, answers it in general, but also offers to walk the asker through the contribution process for that particular project. This should be OK because the offer of contact is helpful and because the specific contribution process would not be of interest to the wider community. The asker had implicitly solicited the contact offer by mentioning a particular project.
If someone would like to solicit contact or promote a project more generally, they can do it on their user profile.
Disclosure: I have previously exchanged contact details on this site, though it was done in a comment thread and not an answer.