Bad Neighborhood
When you link to a website that a search engine has downgraded, whether it be an outgoing or incoming link, your website will likely end up in a bad neighbourhood. Search engines downgrade websites that are harmful, spam, or that contain inappropriate, irrelevant content. When websites use black hat SEO techniques, which are illegitimate ways to manipulate the algorithm to rank higher in search engine results, search engines can penalise these websites. Stuffing backlinks, and using paid backlinks are examples of blackhat SEO.
The quality of the content can also affect the ranking. Even if your website’s content is of good quality, you can still be downgraded for linking with a penalised website or an old website that you linked with but now has been downgraded.