It is usually the achievements in their work that would normally bring them privilegies compared to their colleagues, and the strength of the enterprise they were working at.
One collective would have better benefits than the other collective if their enterprise is more prestigeous. More prestigeous enterprise was usually greater by volume and more impotant to the country. For instance, in the USSR railroads were known to be quite rich enterprises and to provide good sea resorts to their employees. Often military industrial enterprises, associated with secrecy were more prestigeous than the civil industries. Of course getting a prestigeous job would be easier if you are a valuable specialist and have some achevements.
One colleague would have benefits compared to the other colleagues if he has merits and achevements compared to others in their enterprise - overcompletes plans, produces high quality output, makes inventions and proposes optimizations, awarded state awards, prizes and honorary titles, like "merited (job name) of the USSR/contituent republic", hero of socialist labour etc.
Long term job experience would also contribute, some enterprises had strict rules that if you worked for some time you would be given a flat. Some enterprises would attract young specialists from other cities by promising them a flat or a room in a shared flat. Especially jobs located in a cold climate areas, in the far North and East could be expected to provide serious benefits (mostly in terms of money and summer vacations).
The most bonuses were granted to the national celebrities, like writers, artists, actors, sportsmen, scientists, generals, film directors, cosmonauts etc, following their significant achievements (olympic medals, scientific discovery, state prises, orders etc). Such people would be granted summer houses in pine forests, flats in the center of Moscow in ornate buildings etc. They would also likely to be nominated for legislatures ("councils") of various levels.
Note that if your housing capacity was insufficient for your family according to certain standards, the state was obliged to provide you with adequate housing regardless of your job achievements. But this could be in a non-prestigeous, remote place and you could wait for it for a long time moving in a queue.
Of course there were always corrupt schemes where people provided benefits to their relatives, friends, for bribes or for mutual exchange.
Regarding the details, I would say that living in a private individual house was not usually considered more prestigeous than in a state-owned flat in a city. Most of the "middle class" usually had a flat in a city and a summer house beyond city limits. In year-round houses in village and small town areas usually lived peasants and the eldery.