When one laughs with characters, it is because they have made jokes that show their clever and amusing natures. Another reason we laugh with characters is that they have played pranks on a fellow character that we can find amusing. When we laugh at characters it is because they have done something particularly stupid or foolish, showing themselves to be uncouth and uneducated. Shakespearean comedy always includes characters that are either fools or clowns. We typically laugh with fools while we laugh at clowns. Fools are known for their intelligent wit and satire. In addition, fools are often the wisest characters in Shakespeare's plays, making astute philosophical observations or remarks that foreshadow the things to come. In contrast, clowns are usually uneducated country bumpkins and do ridiculous things that are laughable.
Most of the mechanicals can be recognized as clowns, except for Bottom, who is recognized as a fool. We laugh at the mechanicals because their lack of education and mannerisms portray them as doing things that are ridiculous. One example can be seen in the way that they mix up words. For instance, when Quince is mourning the loss of Bottom, he says that no one else can play the part of Pyramus because Bottom is "a very paramour for a sweet voice" (IV.ii.11-12). Since the word paramour refers to an illicit lover, Quince actually meant to say paragon, which is an excellent model. The fact that Quince mixed paragon with paramour shows us how uneducated he actually is. Furthermore, mix-ups such as this provoke the audience to laugh at him and the rest of the mechanicals.
While the audience also laughs at Bottom, he is recognized as a fool rather than a clown because he does say some enlightening things. For example, when Titania proclaims she swears she loves him, Bottom relays one of the play's primary themes of the irrationality of love by saying:
Methinks, mistress, you should have little reason for that. And yet, to say the truth, reason and love keep little company together now-a-days. (III.i.134-136)
Yet, we also laugh at Bottom when he too does ridiculous things, such as decide to ask Quince to write him a ballad to sing before the duke about his dream of being a donkey.
Hence, we see that the reason why we laugh at the mechanicals instead of with them is that they are clowns who are uneducated bumpkins that do ridiculous things.