I can't believe no one has managed to come up with a cure for anorexia yet...
I can't believe no one has managed to come up with a cure for anorexia yet, honestly, I thought it'd be a piece of cake.
This is a pun. The humor of the joke is centered around the phrase "piece of cake". Literally piece of cake means a piece of cake, but figuratively it means "something that is very easy".
To cure anorexia is not that easy because it is mental, and not physical, and we are not good at helping mental issues. So eating cake to cure anorexia is probably possible, though I doubt that it would be effective in most cases. So, not only is there a pun here, but both senses of the pun are absurd, which makes this pretty funny.
That is - of course - if you are ok making fun of people that have an illness.