The title refers to the moment at the end of the short story when the boy, Roger, wants to say more to Mrs. Jones, but could not. The closing lines of the short story capture this beautifully in Hughes' powerful style: "The boy wanted to say something other than 'Thank you, ma'm,' to Mrs. Luella Bates Washington Jones, but although his lips moved, he couldn't even say that, as he turned at the foot of the barren stoop and looed up at the large woman in the door." The title is a direct reference to how Mrs. Jones addressed the situation of the youth attempting to steal her money. The woman's approach of taking the boy home, feeding him, and caring for him strikes at the essence of Hughes' desire to transform what is into what can be, but also strikes at a very humanistic approach to criminal activity. At some level, empathy is needed to help eliminate the reason behind why people commit crimes. In displaying her sense of empathy behind the boy's predicament and caring for him, she has disarmed the boy, and caused him to reflect on his choices and future decisions.
If we are talking about the Langston Hughes story, the answer is because the woman (Mrs. Luella Bates Washington Jones) has helped the boy (Roger) in a very important way. She has given him back his integrity and, perhaps, hope for the future.
At the start of the story, Roger tries to rob Mrs. Jones. But instead of turning him in to the police, she treats him with understanding and respect.
By doing this, she makes him feel like a good person -- she makes him want to behave, as when he does not steal from her when left alone with her purse.
This is a huge gift, and that is why the story has the title it does.
It's called "Thank You Ma'am" because the boy (roger) in the story felt gratitude toward Mrs.Jones .