True or not? In French "s'acheter "or "lui acheté" are optional when expressing "buy for herself/himself"

I have come across this wording meaning "buy for herself/himself “…lui acheté…” which surprised me. I was told it is correct but I haven’t found any grammar website supporting this phrasing. I assumed the only way to express it was using s’acheter. I hope someone can confirm this.

Do you have the complete sentence?
“…lui acheté…” has no correct meaning if just that. (“Lui acheter” means “I buy something for him”)

Here is one example I found.

There is no reference to anyone other than the girl buying fruit for herself:

“Emma s’aperçoit alors qu’elle a faim. À part le civet de roussette de triste mémoire, elle n 'a rien mangé depuis plus de douze heures.
Elle se dirige donc vers le marchand, et lui achète deux bananes, deux mangues et une noix de coco”.

I have seen elsewhere that "lui’ can be translated as “for herself”. But I have only recently seen examples like the one quoted.

So “et lui achète” with this accent means " and buy from him", so she buys the fruits to the merchant. He is the “lui” !

Thank you. That solves that.