I think the 'play-within-a-play' can be seen as a technical innovation, or at least one of the earliest examples of a 'meta-reference' in the theatre. 'The Madness Of King Gonzago' serves as a plot device (
The play is the thing, wherin I'll catch the conscience of the king), and perhaps also symbolises Hamlet's philosophical procrastination, in that the play is an indirect action contrary to an immediate revenge.
The Players are also a means of adding humour to the tragic plot, and the dialogue (And that of Polonius in these scenes) also creates an ironic juxtaposition with Hamlet's soloioquising..
Polonius-The best actors in the world, either for tragedy, comedy, history, pastoral, pastoral-comical, historical-pastoral, tragical-historical [A reference to Marlowe's 'The Tragical History Of Doctor Faustus]
tragical-comical-historical-pastoral, scene indivisible, or poem unlimited. Seneca cannot be too heavy nor Plautus too light. For the law of writ and liberty, these are the only men. [Act II, Scene II, Lines 392-97]