In some ways, the author (O. Henry) is being a bit sarcastic because, as Randy points out, each giver sacrificed much to give the recipient a gift that they couldn't use.
On the other hand, O. Henry can also be understood to be saying that each giver was "wise" because they gave up the material possession that they most prized in order to give the one they loved something that they would prize. What matters is not whether or not the gift is useful but whether or not the act of giving was genuine, sincere and costly to the giver. In this case, each gift was a gesture of love and that, in the end, represents "wisdom" in giving.