Generally, I would be very cautious about moldy foods. To be on the safe side I would rather throw away jam that is covered in mold, yet, there are sources claiming that it is totally fine to eat what is beneath a moldy layer.