Oh my goodness, how can people not understand that it simply sizes the window to be just large enough to show the content. Click it again and it goes back to what it was sized at. What is so freakin' confusing about that?
It is up to the application to decide what the size of its content. If it isn't behaving like above, then tell the app developer they have a bug.
Simple as that.
Because that's not what it does -- it's supposed to do that, but it doesn't. It's not a "bug": it's the example set by Apple in its applications:
Finder: Optimize
Keynote: Optimize
Numbers: Maximize
iPhoto: Maximize
iTunes: Change fundamental UI
Calc: Change operating mode