Because the Man in Black (or Westley) had something in him that was worth living for - true love.
However, it was Max's understanding that Westley would humiliate Humperdinck that made him ultimately agree in reviving the man.
Found in Chapter 7 of William Goldman's The Princess Bride, below is the summary of Westley's revival scene (courtesy of Sparknotes.com):
Fezzik and Inigo carry Westley to Miracle Max, who worked for the king for many years but was eventually fired by Humperdinck. Max shoos them away angrily until they explain that the man is already dead. Max is good with the dead, so he agrees to take a look. He then darts off to tell Valerie, his wife who poses professionally as his witch, that two potential customers have arrived. She hopes that he will help them, but he comes up with excuses why he cannot. Valerie persuades Max to find out why they need the miracle, and using a bellows cram he pumps air into Westley and asks why he must live. Westley replies in a low, almost-dead voice, "Tr…ooooo…luv." When Max writes it off as "to bluff," Valerie runs into the room and rails against him, calling him a liar and explaining to Inigo and Fezzik how Humperdinck ruined Max's career. This segues off into Inigo's telling Max that bringing back Westley would cause Humperdinck great suffering. Max is delighted and agrees to do it.
It's movie adaptation, directed by Rob Reiner, was released on September 25, 1987. Here are 5 Things You Might Not Know About ‘The Princess Bride’ On Its 25th Anniversary, featured on IndieWire.com.