Solenoid and bar magnet both form closed loops of magnetic field lines. But fields are uniform inside solenoid, not inside bar magnet. Why?
Magnetic field is uniform inside both bar magnet and solenoid. In fact in terms of magnetic lines of force a cylindrical bar magnet is indistinguishable from a solenoid.