Okay, this is what's going on.
Suppose we take the first form of the integral
http://latex.codecogs.com/gif.latex?\int(2x+3y)^2dx
We get
http://latex.codecogs.com/gif.latex?...\frac{9y^3}{2}
Now if we expand first and then integrate, we get
http://latex.codecogs.com/gif.latex?...3}+6x^2y+9xy^2
Remember how in calc 1, our teachers kept marking off all our points because we kept forgetting to add "+c", the arbitrary constant, when we evaluated integrals? Well we should have listened to her.
The difference between the two terms is 9y^3/2. That's just the arbitrary constant (constant because we integrated with respect to x and that doesn't depend on x). When we expand first, we should add an "+f(y)" term for us to be correct. Then note that since any equation of that form is correct, and both of our answers are of this form, then both answers are correct (just like how "x^2+3" and "x^2+5" are both the correct answer to the integral of 2x even though they're two different functions).
Note that since his problem had boundaries, the arbitrary constant drops out. So he could solve the problem by expanding first or by not expanding and he would still get the same answer. So expanding the quadratic term is a legitimate strategy afterall.
But the reason we're gettting different answers when we do it different ways is because of how we're not taking into account arbitrary constants. Both answers we get returns the original function when you differentiate them. Both final answers return the original function when we differentiate with respect to y and then with respect to x. So essentially we got the multivariate equivalent of two antiderivatives being correct because they only differ by an arbitrary constant. And there's infinitely other possible correct answers too.
@Julian: I haven't done lagranged multipliers in so long, so I can't really help you here. I'd have to look it up first, but your exam is tomorrow and I probably wont get around to looking it up today. Sorry x_x I noticed that every time you ask a question I'm always unable to help you for some reason lol