Vayakhel (37:5) says that B'tzal'el built the aron and put its staves into the rings on its sides.
P'kude (40:20) says that Moshe put together the mishkan and put the staves on the aron.
Mi Yodeya is a question and answer site for those who base their lives on Jewish law and tradition and anyone interested in learning more. It only takes a minute to sign up.Sign up to join this community
A couple of possibilities:
Betzalel may have put them in temporarily (to make sure they fit), and Moshe was the first one to put them in permanently (after which it was prohibited to remove them again, as stated in Ex. 25:15. Daas Zekeinim on that verse in fact explicitly states that this prohibition took effect once Moshe put them in).
Or, וישם in 40:20 may be meant in the same sense as ושמו בדיו in Num. 4:6, where Ramban writes (second explanation) that it means to adjust them to the correct position. (As pointed out in Yoma 72a, the staves could slide back and forth in the rings, they just couldn't be removed completely.) So then it would mean that Betzalel placed the staves into the rings, and then when Moshe set down the Aron in its proper place in the Kodesh Hakodashim, he slid them into another position (perhaps so that they'd bulge out of the paroches, as later in the first Beis Hamikdash - Yoma 54a explaining I Kings 8:8).
Meshech Chochmah writes (paragraph beginning וע"ד המושכל) that the staves had to always remain with the Aron in order to demonstrate that the Aron "carried its bearers"; removing them when it was at rest and attaching them only for transit would falsely imply that they were actually needed in order to carry it. This page expands on this idea to point out that the order in 40:20 is significant: first the luchos had to be placed in the Aron (to "activate" its power to carry itself and its bearers), and only then could the staves be attached to it. This would seem to fit with my first answer above: Betzalel put in the staves and then took them out, and Moshe again attached them after he put the luchos inside.
On the other hand, I see where Meshech Chochmah also says (paragraph beginning ויקח) that the staves were at the sides of the Aron when it was in transit, but that they "placed them atop the sides of the Aron, making them lie across the top of the Aron" when they set up the Mishkan. (Which, I guess, means that he holds that the mitzvah to "not remove the staves from the Aron" means that they should always be somewhere nearby, but not that they have to remain in the rings.) He uses this to explain the apparent contradiction between the two verses: Betzalel placed the staves into the rings, and Moshe removed them and laid them atop the Aron.
Oops, I missed that Alex added this answer above, but I'll keep it here for the comments.
The Meshech Chochma answers that Betzalel placed the staves in the rings on the side of the Aron. This was its mobile positioning. When Moshe set the Aron in place, he set the rings and the staves within on the top edges of the aron's walls. This was its resting position.