In ep31, Light says he had misa sign off as the notes owner, and hence she loses her memory. In the earlier eps, it was shown that Light used misa's note to keep his memories. But as soon as the book was given away, why didn't he lose his memories?
For the same reason he was able to defeate Yotsuba Kira: When he touches a note that he once owned, he temporarely regains/ keeps his memories.
I don't find a reference just now but some time after the first major climax half way through the manga, Light explains to Ryuk/ us that he keeps physical contact to a note using a corset. As long as he touches a note he once owned (and at some point he owned every last one that became part of the human world at some point), he temporarely holds his memories. And since it is old trickster Light, temporarely happens to be several months.
I will go through the manga again late this week and hope I can find the chepter.