Is there a rule to determine whether or not 「に」 should be attached after 「まま 」?


In the example sentences of my textbook for the grammar 〜まま, it is used either
with 「に」 (①) or without 「に」 (②,③): ![enter image description
here](https://i.stack.imgur.com/MkVGf.jpg) In the case of ②, I understand that
「に」 is not necessary as まま is not acting as an adverb. Again, at ① it is used
as an adverb so 「に」 is attached to it. What bugs me is the example sentence ③.
I do not understand why 「まま」 is not attached「に 」even though it is modifying
the verb:

> 靴【くつ】を脱【ぬ】がないでそのままお入【はい】りください。

Initially, I thought it might be one of those cases where a particle is
ommitted in some instances and both possibilites (namely attaching 「に」or
ommitting 「に」) are equally acceptable.

However, I encountered the same sentence later on as part of an exercise where
I am asked to pick one option from either: ![enter image description
here](https://i.stack.imgur.com/W4N63.jpg) so obviously, the only possible
option is not to attach「に」to 「まま」just like in the initial example sentence ③.

Why? What am I missing here?

Your help is much appreciated.

EDIT: Thanks to user3856370 for pointing out
[here](https://japanese.stackexchange.com/questions/68980/is-there-a-rule-to-
determine-whether-or-not-%e3%81%ab-should-be-attached-
after-%e3%81%be%e3%81%be#comment116409_68980) that the「に」in ① comes from the
grammar pattern noun+になる (and similarly, noun+にする), where 「まま」 is the noun.The
example sentence ① is one of such cases.

> その書類【しょるい】は後【あと】で読【よ】みたいからしまわないで、その **ままに** しておいてください。

