What does the apple in "A Poison Tree" by William Blake represent? Does it have anything to do with the persona's revenge on his foe?
In my opinion, we need to look no further than the poem itself to find out what the apple represents. Here are Blake's words:
I was angry with my foe: / I told it not, my wrath did grow. / ... / And it grew both day and night, / Till it bore an apple bright,
Yes, there is a stanza missing where my ellipses is found which tells exactly "how" the apple grew, but the preposition "it" still refers to wrath. The apple, then, represents bottled up wrath. Another word for wrath, of course, is anger. Many people speak of "bottled up" anger, but in this case the wrath is "bottled" into a grown apple.
Now, in regards to your next question: whether the apple has anything to do with revenge we can, again, explore the poem for the answer. The irony here is the answer can be found within the ellipses of my last quotation: the second stanza.
And I watered it in fears / Night & morning with my tears, / And I sunnéd it with smiles / And with soft deceitful wiles.
Revenge is causing injury/harm in return for a past wrong. Above we can see that the speaker plans exactly this, not because of his "fears" and "tears" but because of his "smiles" and "deceitful wiles." Wiles are plans that are being made. That these plans are "deceitful" mean that they are plans for woe and not for welfare. The speaker proves this with his smiles. Apart from this, there is another proof of planned revenge:
In the morning, glad, I see / My foe outstretched beneath the tree.
In these lines, we see that the speaker was "glad" at the death (or perhaps the debilitating poisoning?) of his foe. We can relate this word "glad" with the speaker's "smiles" and "deceitful wiles" from above to show that the speaker did, in fact, mean revenge.
The apple represents all of the pent up frustration or anger that the speaker has for his enemy. He never got whatever problem he had with his enemy off his chest. So instead of venting like he did with his friend, and working it out together, his anger and bitterness slowly grew. It is "cultivated" in the poem, and ends up turning into wrath, or the apple.
The apple itself is not necessarily revenge on his enemy, but it ends up functioning that way. Whatever he held in so long, when finally exposed to his enemy, ended up destroying his enemy.