Pain is very subjective. There has been very likely a time when you’ve hurt yourself and how severe or mild it felt to you was quite different from someone who was watching or helping you. How people feel pain and how others perceive it are often two very different things.
In your mother’s case, there are many issues that may be play. While it is possible that she is “trying to get attention,” but the complex nature of pain may mean it’s more than that. Perhaps while you are visiting, her pain isn’t noticed as much because she is talking to you and thinking of things other than pain. Perhaps she took a pain reliever before you came and it’s worn off by the time you must leave. Perhaps she’s lonely and depressed, two things that have been shown to increase pain, and your departure triggers this.