Bai's poem is a tiny story about an odd birthday gift. The speaker remembers giving a friend a single sock, with a note pinned to its bright fabric that says, "You're a free elf." That's the whole scene, and the strangeness is part of the charm.
The reference to elves seems to come from the idea of house-elves who are freed by being given clothing, though the poem never says so, so that's an inference. If it's right, the sock is a playful way of telling the friend she is liberated, no longer bound to anyone's orders. The gift becomes a joke, but also a kind compliment.
The speaker seems affectionate and a little mischievous. The mood is light, quirky, and warm, like an inside joke between close friends. The short, plain lines make the memory feel casual and sweet, as if the speaker is smiling while telling it.