Obfuscating insanity —uh, faking madness to throw people off—is one of the oldest tricks in the book. In Hamlet, Shakespeare takes it up a notch: does Hamlet truly go "mad," or is the cuckoo-talk, like the play itself, all an act? And if madness is a form of theatricality (maybe with some "method" in it, as Polonius says) —does that mean that all actors are crazy?
While Hamlet's "mad" behavior starts out as an "antic disposition," his mental state deteriorates over the course of the play so that he ends up legitimately insane.
It's impossible to know whether or not Hamlet is actually "mad," because our uncertainty about Hamlet's mental state is supposed to mirror the play's general ambiguity and doubt.