1. They built us a new house.

2. They built a new house for us.

3. She cooked us noodles.
4. She cooked noodles for us.

5. He bought me a fountain pen.
6. She bought a fountain pen for me.
=============
Is each pair grammatical and the same in meaning?

Yes, all are fine and mean the same thing.

You clearly know that the first of each pair uses an indirect object, while the second of each pair turns that indirect object into an object of a preposition.

Very good! =)