They are not selling just the product. Just like microbreweries, small farms sell for people who want more than just a beer or lettuce. They want to distinguish themselves and buy the feeling of authentic life and values. Consumer pays more for "small farm" even if the product is not any different from neighboring farm product that is not marketing itself as "small farm".
Modern consumer marketing sells identity, lifestyle, and values. There is no reason why small farm products can't create value from association and self–identification just like Pepsi is not selling sugar water or Nike is not selling sneakers. Everything that is sold using words classic, authentic, natural, original can be more expensive for segment who wants those tings.
Traditional farmers who produce standard grain or milk in bulk quantities are selling for different market segment.