Does Epicurus contradict himself by seeming to say that both absence of pain and pleasure are the goal of life?
There is no contradiction because Epicurus is defining "absence of pain" to mean nothing more and nothing less than the word "pleasure" itself. Since there are only two feelings, pleasure and pain, the absence of one IS the other, and vice versa. The terms "abscence of pain" and "pleasure" are therefore completely interchangeable.
This equivalency is clear when you read the Letter to Menoeceus as a whole, but it is even more clear in the statements of the Epicurean Torquatus in Cicero's "On Ends":
On Ends Book Two, 9 : Cicero: “…[B]ut unless you are extraordinarily obstinate you are bound to admit that 'freedom from pain' does not mean the same thing as 'pleasure.'” Torquatus: “Well but on this point you will find me obstinate, for it is as true as any proposition can be.”
On Ends, Book Two, 11: Cicero: Still, I replied, granting that there is nothing better (that point I waive for the moment), surely it does not therefore follow that what I may call the negation of pain is the same thing as pleasure?” Torquatus: “Clearly the same, he says, and indeed the greatest, beyond which none greater can possibly be.” (Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Cic. Fin. 2.11)
On Ends Book Two, 16 : “This, O Torquatus, is doing violence to one's senses; it is wresting out of our minds the understanding of words with which we are imbued; for who can avoid seeing that these three states exist in the nature of things: first, the state of being in pleasure; secondly, that of being in pain; thirdly, that of being in such a condition as we are at this moment, and you too, I imagine, that is to say, neither in pleasure nor in pain; in such pleasure, I mean, as a man who is at a banquet, or in such pain as a man who is being tortured. What! do you not see a vast multitude of men who are neither rejoicing nor suffering, but in an intermediate state between these two conditions? No, indeed, said he; I say that all men who are free from pain are in pleasure, and in the greatest pleasure too.