Replicators don't just create matter out of thin air. They need matter stores, which in the case of food replicators would have to consist of proteins and other necessary nutrients. Absent those, you can have all the replicators in the galaxy and still starve to death.
Actually, replicators convert energy into matter at the subatomic level, so you don't need "food stores" of proteins, you just need ample power reserves for conversion.
Actually it's neither of the above. Replicators don't convert energy into matter; since E=mc^2, you'd need a Hiroshima bomb's worth of energy to replicate a paper clip. Replicators convert raw matter stock into the desired forms. However, you don't need proteins and nutrients to begin with; all you need in principle are the raw materials such as carbon, hydrogen, oxygen, and nitrogen. Except the TNG Tech Manual does say that to minimize power usage, shipboard replicators draw on "a sterilized organic particulate suspension that has been formulated to statistically require the least quantum manipulation to replicate most finished foodstuffs" (p. 91).
However, it would probably not be energy-efficient to run an entire planet on replicators. Perhaps they are used aboard starships to conserve the usage of interior space on the ship, etc., while planets -- which can produce food the old-fashioned way at a fraction of the energy cost -- still rely on agriculture and aquaculture for sustenance.
Except mass agriculture is rather wasteful and environmentally destructive. It could be fairly efficient if done hydroponically or aeroponically, but replication of foodstuffs would probably be more efficient overall, since you wouldn't need to devote thousands of acres of land and vast amounts of water, nutrients, fuel for farm equipment, etc. to very gradually producing edible food.
Well, I guess it depends on the type of agriculture. Livestock agriculture is insanely wasteful; you could feed a small village with the grain it takes to raise one cow to maturity. If the Western world went vegetarian, Earth would have no food shortages and much less of an energy crisis. So I suppose I can see farming being a viable means of raising grains, vegetables, etc. even in a civilization with replicators -- assuming that you have whole planets to spare for the farmland -- but there's no way that raising livestock the old-fashioned way could possibly be more efficient than replicating meat (or, more realistically, cloning animal tissues from cultures).