Tarberries are a required component of Berry Mentats, which give a substantial +5 boost to Intelligence, and thus earned experience. Under normal circumstances, this works out to about a 16.666% bonus. This is likely the reason that tarberries are one of the rarer crops in the Commonwealth.
Tarberries can only be farmed at The Slog settlement: a swimming pool containing eight farmed tarberry plants which can normally be harvested once a day. You are not required to have The Slog as a settlement to harvest the berries, but the settlers must be alive, and if you do have the settlement, settlers must be assigned to farm them like typical crops.
Most companions will comment on the ingenuity of farming tarberry in a former swimming pool, alluding to the general Commonwealth knowledge that tarberries are rare and difficult to cultivate commercially. The ghouls at The Slog say that they have the best tarberries in the Commonwealth, but truthfully, they have the only cultivated tarberries in the Commonwealth.
Tarberries cannot be planted, and can only be found growing in ponds, swimming pools, and on any surface of still water. General goods vendors (i.e. Myrna and Trashcan Carla) occasionally carry 1-3 tarberries for sale. Locations notable for quantities of renewable tarberries:
Massachusetts is known for its cranberry bogs at Cape Cod, southwest of Boston. The tarberry is riff on that, as cranberries only grow in water and are similar in shape and size to the tarberry image. Also, the fact that they only grow in water would explain why they can't be planted elsewhere.