What is the purpose of this verse?
It is hard to reconcile it with Jesus' general position of placing the poor on the top of the list of priorities.
There's an obvious conflict in this scene of course. Jesus has to be anointed. But many readers might ask "why not sell the oil and give the money to the poor like Jesus suggests the rich man do in Mt 19:21?" And, indeed, the disciples foil out that very question.
Is the verse in question the only answer the Gospel authors could think of or does it have some deeper meaning?
And what does it say of the Jesus character?
In the context of the narrative, this is Jesus' way of saying to Judas that he knows that Judas doesn't intend on salvaging the money for the poor, but rather for himself. Remember, he betrayed Jesus for mammon.
However, what you've highlighted I too have cited to show that poverty will never be eradicated, regardless of all the prayers and works in the world. A pretty stunning admission considering it was the same guy that said "Nothing is impossible for you... if you have faith." So which is it? Is nothing impossible, like the eradication of poverty or will the poor always be with us?
"Reason obeys itself; and ignorance submits to whatever is dictated to it" -- Thomas Paine