They do not harm it. There is no credible mechanism by which playing games would damage your memory, and some research suggests the opposite — certain games appear to sharpen it.
Where games can have a cost is in time. If they crowd out study or erode your attention because you are playing when you should be doing something else, that is a scheduling problem rather than a neurological one.