This is a good article on how the overall quality of a site affects SEO. At the end of the day, not all of SEO comes down to code or meta tags – a big part of it is about the user experience, and many users are very visually-driven. If a person comes to a website and finds a poorly designed, badly coded website that looks like it was made in the 90’s, they might be less likely to stay on the page, and there is evidence that Google takes bounce rates into consideration in rankings. Remember that the goal of search engines is to provide the best results for any given search. As such, it makes sense that low-quality sites are negatively impacted in rankings.