It’s not about whether a link is paid or free; it's entirely about the Quality and Footprints. Google doesn't have a magical way to know if money exchanged hands, but it can easily detect a link pattern. If you buy links from public networks where everyone gets a link, it will definitely harm your site.
However, if you pay for outreach to a real, high-traffic website in your niche for a contextual placement, it passes massive authority. Free links can also harm you if they are just automated spam on dead Web 2.0 platforms.