On finding a lump you should always seek vetinary care as soon as possible.
Tumours and cancers usually occur in old hamsters and are more common in females over males. Internal tumours such as those involving the internal organs can often be hard to treat but external tumours can often be surgically removed. A hamster suffering from cancer may develop a hard lump which may increase in size quite quickly. Tumours may be accompanied by fur loss, lethargy, poor condition or wasting but not always,
These occur when a bite, scratch or wound becomes infected and pus forms under the skin resulting in a lump. If a bite or scratch can be seen it is likely this is an abscess over a tumor, you will need to visit your vet to get it drained and cleaned to remove the injection. Often these injuries occur in the pouches when sharp bits of food catch the gum, this can often be mistaken for the hamster pouching bedding or food but if it lasts more than an hour or so you should call a vet to make an appointment.