If it's cancer it can be quite a slow painful death over a long time sometimes which is why it can be kinder to have them put to sleep. If it's an abscess it could be treated but it could be quite expensive in vet fees. If it's an impacted cheek pouch that can be treated but can be quite complicated in an older hamster and a vet may still suggest having them put to sleep. My only experience of something similar was a Roborovski hamster with a lump, which he lived with for quite some time while on pain relief and I hoped he would just pass naturally, but he started chewing at the lump and my vet said that is a sign he is in pain and trying to amputate the thing causing the pain so sadly he had to be put to sleep to avoid suffering.
Unfortunately, we don't know what it is. Rainbow's idea of an animal charity is a good one.