Biomass does come from the outside though on earth - rainfall and photosynthesis are sufficient to increase the mass unless said farm is a closed cycle hermetically sealed dome.
That said it still could run into problems with other requisite elemental depletion in soil even with assistance of things like bacteria. If the plants need calcium and it is all extracted then thr farm would be limited to simpler life that doesn't need any trace elements. If say algae can get by on just atmospheric gas components, water, and sunlight indefinitely then a hypothetical algae farm could run indefinitely. But there isn't much of a market for algae.
That said it still could run into problems with other requisite elemental depletion in soil even with assistance of things like bacteria. If the plants need calcium and it is all extracted then thr farm would be limited to simpler life that doesn't need any trace elements. If say algae can get by on just atmospheric gas components, water, and sunlight indefinitely then a hypothetical algae farm could run indefinitely. But there isn't much of a market for algae.