Building farms on a planet increases raw production on that planet only (well, and the empire's total raw production, of course). Nowheresville IV and Backwater II get no (direct) benefit from the 72 billion people on Overpopulated V, unless you happen to be into the "build a colonizer or transport at a high population planet and land them at low population planets to transfer population around" game.
Therefore, is this a boost to the sum amount of empire-wide raw production, or is it merely localised to that one planet?
I don't know that I understand the question. To me, the answer to each part of this question is yes; after all, increasing the raw production on one planet cannot help but increase the sum amount of raw production in the empire, and yes, only the planet where the farms are built sees any direct benefit from the farms.
By "sum amount of empire-wide raw production," do you mean something more like what Enhanced Production gives you (+1 production on all planets) than the sum of the production values of all planets in the empire? That is a very uncommon bonus; Enhanced Production is the only commonly available means of obtaining a flat empire-wide production bonus that I can think of, and if I recall correctly only the Thalan tech tree offers another flat production bonus that applies to every planet in the empire, and that's from a one-per-faction wonder.