What is the meaning of Matthew 26:8-9?

8 But when his disciples saw it, they had indignation, saying, To what purpose is this waste? 9 For this ointment might have been sold for much, and given to the poor. (Matthew 26:8-9 KJV)

William Burkitt’s Commentary

That is, when Judas, and some other disciples whom he had influenced, saw this action, they murmured; particularly Judas blamed this holy woman for needless prodigality, and did tacitly reflect upon Christ himself, for suffering that wasteful expence. O! how doth a covetous heart think everthing too good for Christ: he that sees a pious action well done, and seeks to undervalue it, show himself possessed with a spirit of envy. Judas’s invidious spirit makes him censure an action which Christ highly approved.

Learn thence, That men who know not our hearts, may through ignorance or prejudice, censure and condemn those actions which God doth commend and will graciously reward. Happy for this poor woman that she had a more righteous judge to pass sentence upon her action than wicked Judas!