A link farm is a website that lists a collection of all kinds of links in no particular order. Anyone can submit their site to be listed in link farms, without having to undergo a process of review. Link farms were set up for the purpose of artificial link building and are hence accorded no value by the search engines.
Web directories on the other hand, are websites that list and classify websites by categories and sub categories. In order to get a site listed in a web directory one would have to submit the site to the directory along with a few details, including titles, descriptions and keywords. Most sites that are submitted to directories will have to undergo an editorial review. If the site adheres to that directory's guidelines and is found to be a relevant, quality site, a link is allowed in the directory. Since links in web directories are sorted according to category, they are relatively easier to find. When search engines find these links under relevant categories, with meaningful link texts/titles, it becomes easier for them to classify the theme of the site. As such, search engines value directory links.