Translation of 頂きもの in this example sentence

There’s this example sentence for 頂:

The translation seems off to me. As I understand 頂きもの is something the speaker receives from someone (a gift from よそ to うち). So how does it translate to “If there is anything of mine that you’d like”?

I imagine this sentence could work in the context of the speaker getting some sweets as an omiyage from 3rd party and offering a bite to someone.

I think it’s just one of those cases where the English sentence is one valid way an English speaker would talk in the scenario of the Japanese sentence, but it is not so literally translated to be specific to that situation.

More literally it would be something like “I received this as a gift, but help yourself if you’d like.”