During his examination, Tom Robinson tells the court that he helped Mayella Ewell on several occasions because he felt sorry for her. Scout instantly recognizes this confession as a mistake. For their society, even though Tom is better off that Mayella (he has a loving family) he is black and therefore can't fell sorry for a white woman, no matter how poor her circumstances. She also notes how the prosecution refers to Tom as "boy" throughout the questioning process.
Tom's sympathy for Mayella is at the heart of the case against him. The day in question, he was helping her break up her old cabinet because he felt sorry. She was lonely and appreciated the attention he was giving her, so she hugged him around the waist. This is when Mr. Ewell walks and and Tom runs away.
In his summation Atticus tells the jury that there was no real crime committed. Mayella was lonely and sought attention from Tom. She may have been attracted to Tom, but that's only wrong because society believes it to be so.
"She has committed no crime, she has merely broken a rigid and time-honored code of our society, a code so severe that whoever breaks it is hounded from our midst as unfit to live with. She is the victim of cruel poverty and ignorance, but I cannot pity her: she is white. She knew full well the enormity of her offense, but because her desires were stronger than the code she was breaking, she persisted in breaking it. […]