It may be easier to understand what's going on if you look at the chain of function calls that the second one devolves to (I'm using the operator defs here, which do match the gcc headers on my system):
cout << b << " " << ink(a) << " " << b;
operator<<(operator<<(cout.operator<<(b)," ").operator<<(ink(a)), " ").operator<<(b);
Aside: This looks very odd because the numeric inserters are all methods of the object, while the character string inserters are all global functions, which makes the call order even more strange than it might be.
Now that you have the actual call chain, you can see how it would end up putting the 7 on the stack before the 'ink' call, but actually won't use that until well after, thus causing the non-intuitive outputs.