That is because
function($) {} (window.jQuery);
is not valid in syntax, but
!function($) {} (window.jQuery);
is valid.
Now the question is why the first case is invalid?
Let's first take look at this. Both anonymous functions and named functions can be considered as a expression, e.g.
0 + function(y) { return y; } (1); 0 + function x(y) { return y; } (1);
are both valid.
Then consider this situation, this statement contain one expression
function x(y) { return y; } (1);
"That's incorrect!" may you say that because you know they are actually one function definition and one statement with one expression (1).
The truth is, those codes is ambiguous to a grammar parser, because it could be resolved as either one function and one parenthesis-wrapped expression, or a function invocation. To avoid this kind of ambiguous, Javascript rules that if function occurs as the first token of a statement, the statement ought to be a function definition. So function($) {} (window.jQuery); is not valid in syntax because it's not a valid function definition. But prepose a ! or even this kind code is valid
0 + function x(y) { return y; } (1);
It's one statement, with a binary plus, whose rhs is the function invocation, inside it.