Difference between まで and に when using a Number counter


i wanted to know the difference in nuance between まで and に, when used to
represent the number counter, in the following 2 sentences.

四十までアパートに入れます. (Means upto 40 people can enter the apartment)

Vs.

四十にアパートに入れます. (Means 40 people can enter the apartment)

As per my understanding of まで, in the 1st sentence 四十まで is acting as a
limiter, i.e. upto 40 people can enter into apartment. In other words, there
is a limit of 40 people that can enter the apartment, be it due to size of
apartment or other restrictions.

Whereas, when に is used it is just a statement that 40 people can enter the
apartment, whereas, there isn't any inherent restriction/limit on the number
of people that can enter. E.g. group of xyz number of people will enter first
and then the rest 40 can later. However, I am not sure about this reasoning.

Can anyone please tell me the difference between the two?

