There are many reasons for the prices of the goods (specially vegetable, fruits, grains etc) to be higher than the prices of them in the villages.
Now, your concern about the farmers getting less amount is mostly because of the monopoly of the bulk buyers. Farmers have to sell their crops before they get rotten or damaged and sometime they don't have enough space to store the crops and need to get prepare for the next seasonal crops. Bulk buyers get benefits from this and other situation and give the farmers the price which they want.
Thanks & Have a nice day.
Cities are perceived and are no doubt the aboard for the rich wealthy. Marketers purposely adjust the price of foodstuffs in the city because they are aware that the wealthy ones recide there. I am saying this out of experience because I have been opportuned to live in an estate where the price of foodstuffs inside the estate is not the same with the price of foodstuffs outside the estate.
Another cause for the high price of foodstuffs in the city is that most of the foodstuffs are being imported from the villages down to the city and that will cost the traders some money depending on how far the distance to the city is from the village. Traders now raise the price of the goods so as to recover the money used to import the goods and also make gain from the trade.
If your concern is for the farmers I must tell you that the farmers have the right and also so adjust the price of foodstuffs especially during the dry season.
@Erica20, In my opinion there is an very simple reason and that is, in city the Income level reaches high due to more developments and the more income means, more potential of spending power, so more income means the buisnesses and seller points set high rates for products and services.
In my opinion, it's an unfortunate aspect that people are missing out the pain of farmers in most of the cases and i think it's not good because they are the one's who need more care.