Welcome to Flyertalk.
I don't think it's based on just rate, but that will play into it.
Each hotel will be different, but I would assume most use all or some of the following in their decisions
- Type of room booked
- Elite level of guest
- Guest profile preferences
- Room Rate
- Occupancy Level
Much of what people think the hotel is doing with magic and all that may just come down to which room housekeeping has ready when you stand at the desk or they start assigning rooms, or who checked out that day.
I would not worry that just because you are on a discounted government rate you will be at the bottom of the room selection. They also know you are likely to come back and want to do what they can to get you to visit them again.