You are right in indicating that both of these excellent short stories have ironic endings. I would like to deepen this by pointing out that both of these short stories use situational irony in the endings that they describe. Let us remind ourselves that situational irony is defined as when something happens that is the opposite of what we would normally expect to happen.
Clearly, the ending of "Lamb to the Slaughter," where we see Mary Maloney's transformation from a pathetically loving and dedicated wife to a cold-blooded, callous murderer who delights in the way that she tricks the policemen into consuming the murder weapon is a prime example of this. We would never expect, from the way that Mary Maloney is described at the beginning of the story as she awaits her husband's return from work, that she could ever giggle as she does at the end of the story as the policemen enjoy the meal she prepared for them and talk about the murder weapon:
One of them belched.
"Personally, I think it's right here on the premises."
"Probably right under our very noses. What you think, Jack?"
And in the other room, Mary Maloney began to giggle.
Of course, note how this ending also combines dramatic irony with the situational irony, as the policemen are unaware that the murder weapon is right under their "very noses," as they eat it.
In the same way, the ending of "The Gift of the Magi" involves biting situational irony as we realise that, in selling her hair to buy Jim a fob for his watch, she is unable to enjoy the combs that he has sold his watch to buy, just as he is unable to use the watch fob that she has sacrificed so much for. In both stories, then, the opposite of what we expect happens, thus demonstrating the power of situational irony.