The "cow-keeper"-story? My person remembers a possible common know story about a Brahman collecting as much as possible cow's leading to sorrows for poor. The Sublime Buddha approached him one day, gave a talk and later he released the cows.
It might be that's just a later tale not found in the scripts, my person just does not remember where having been come across aside in an illustrated &quot;Children&quot;-book.
Good if one likes to share messages on livelihood.
[Note that this isn't given for stacks, exchange, other world-binding trades but for release from this wheel]
The following is somewhat like the posted question, but not exactly:

SN35.241:7.4: Sir, may I receive the going forth, the ordination in the Buddha’s presence?”


SN35.241:7.5: “Well then, Nanda, return the cows to their owners.”


SN35.241:7.6: “Sir, the cows will go back by themselves, since they love their calves.”


SN35.241:7.7: “Still, Nanda, you should return them to their owners.”

Here the Buddha emphasizes ethics in our relationships with others. The Noble Path starts with Right View.