Confusion with impedance matching example using an ideal transformer
For a normal power transformer, it will have an equivalent circuit like this: -



To make it ideal we turn the series components Lp, Rp, Rs and Ls into short circuits and we open circuit the components Rc and Lm.

This leaves us with a perfect ideal transformer and that will do two things: -


Take only the power needed by the load from the driving (primary voltage)
Reduce or increase the secondary voltage by a factor called the "turns ratio".


The impact of this is that the secondary load appears at the primary terminals multiplied by the turns ratio squared.

Picture taken from this site. That site might also help you understand how transformers work.

For a more practical transformer, we can choose to introduce Lm and that introduction causes a primary current in addition to the primary referred load current AND, that additional current through Lm will be 90 degree lagging. Maybe that is where you are getting confused. In an ideal transformer, Lm is assumed to be infinite.