I come into this question with an assumption which I'm aware might be wrong, namely that the newly-empowered communists would've been ideologically wary about giving over many of these buildings to local officials or notables. I'm sure that at least a few were used as Party residences or variously repurposed into government buildings or public housing depending on their locations, but what of the rest? Was there a rapid drive to repurpose and/or remodel them for new intent, and if so what were their common final states? What factors contributed to differences in outcome between one mansion and another?
(By-the-by: I've asked this question for the Soviet Union specifically in order to keep answers focused, but I would welcome an answer from the perspective of any communist nation.)
Oh great, I'm glad you decided to post this question again! I was off the grid the last time you posted it so I wasn't able to answer in a timely manner and by the time I saw it, more than a week had passed which is basically a decade in r/AskHistorians time. u/mimicofmodes, I've been given a chance to redeem myself!
So, to start-- you're not wrong at all, many of the assertions you make in your questions are quite correct. Namely, most of the buildings of imperial splendor were repurposed as Communist Party gathering halls of some kind, party residences, or buildings for public use. That means that these ostentatious dwellings were turned into things like schools (or universities), hospitals, museums, and hotels. The RSFSR Constitution (1918) guaranteed dwelling and organizational space for all oppressed classes with Article II, Chapter V, Item XV:
The Russian Socialist Federated Soviet Republic, having crushed the economic and political power of the propertied classes, and having thus abolished all obstacles which interfered with the freedom of organization and action of the workers and peasants, offers assistance, material and other, to the workers and the poorest peasantry in their effort to unite and organize. [1]
As a brief aside, one has to credit the Bolsheviks-- I've never seen another constitution (even including the revolutionary French Constitution of 1791) that uses such edgy language concerning the rights of man. These folks were not playing around.
One potential misconception I noticed in your question (though it might just be my misinterpretation) is that these palaces or mansions were just given wholesale to a single individual or family. That definitely did not happen, or I should rather say, it was not the norm. These huge estates were often split up among many, many individuals or several families-- for example, an entire group of employees who worked in a single organ of the state might share the living quarters. When the Soviets actually began to legislate on the expropriation of living space in 1918, the mandate was one room per person or couple, one room per child. Kitchens, restrooms, sitting rooms, etc. would all be communal. Even the early Bolshevik leaders like Lenin, Stalin, Trotsky, and others lived in fairly humble quarters (albeit inside the Moscow Kremlin) given their newfound status as leaders of the workers' revolution. Stalin shared a small room with his daughter for a good period of time-- while in a position of dictatorial power and conducting a mass terror campaign against the entire country no less.
Okay, so remember that when the October Revolution occurred in 1917, the Russian Empire was about three years into a war that had been going really sideways for them from just about the beginning. Among other less-than-ideal side effects, that meant that large amount of peasants and workers who had been living in the villages were moving into the cities as the Imperial German Army pressed further and further into Russia. This affected many different cities of course, but especially the imperial capital Saint-Petersburg (which had been renamed Petrograd at the outbreak of the war because the prefix Sankt- and suffix -burg had German origins). This created a twofold problem, as it relates to this question:
As early on as the February Revolution (which saw the emperor Nikolai II dethroned, and the monarchy destroyed) Red Guards, sympathetic soldiers, and organized groups of workers had begun to take control of former landmarks which, to them, embodied the flagrant wealth of the imperial and landed classes. One famous instance was the Hotel Astoria right in the middle of the Petrograd city center-- during the war it had been renamed the Petrograd Military Hotel and was being used to house wounded soldiers and the military upper crust-- but after the first, softer revolution, the hotel/hospital was occupied, its imperial fixtures stripped and thrown into the nearby Neva River, and it began to be used to house the great, unwashed masses in need of more suitable accommodation. On top of that, similar groups would simply kick in the doors of various palatial estates throughout the city and ransack whatever they could find (after their owners had often already ransacked the properties themselves if they had been among those who tried to flee Russia altogether). There were various outcomes which occurred when these groups happened upon actual residents of these lavish estates-- as you might guess, they were usually not great. Cambridge Professor Hubertus Jahn described these events thus:
Sadism and cruelty, personal enrichment, political fanaticism, class hatred, and vague ideas of social justice were major traits of these raids. [2]
That said though, Jahn also notes an American living in Petrograd who, upon introducing himself as such following his door being pried open and angry revolutionaries bursting in, was met with smiles, tea, and warm wishes for a pleasant stay in Russia. Absolutely bizarre at points, the revolution was.
So that sets the stage for after the October Revolution (or coup d'etat) succeeds. Many or most of the building which your question is asking about were already under the control of someone other than their original owners so then it fell to the Bolshevik leadership to step in and adjudicate this sort of ad hoc repurposing (to put it mildly).
Now before going on, while to us looking back on these actions, they obviously come across as quite callous, cruel, and indeed, outright criminal in many cases, the fact of the matter is that the Bolsheviks and their cohorts (the former probably knowingly, the latter more likely just out of instinct) were acting in perfect accordance with ideas put forward by their intellectual forebearers. In his 1872 essay The Housing Question, Frederich Engels himself had written:
[O]ne thing is certain: there are already in existence sufficient buildings for dwellings in the big towns to remedy immediately any real 'housing shortage,' given rational utilization of them. This can naturally only take place by the expropriation of the present owners and by quartering in their houses the homeless or those workers excessively overcrowded in their former houses. [3]
Lenin endorsed Engels' position (even titling the chapter of essay in which he did so The Housing Question, and explicitly referencing Engels' earlier work) in his rather long essay The State and Revolution (1917):
Expropriations and billetings take place by order even of the present state. From the formal point of view, the proletarian state will also 'order' the occupation of dwellings and expropriation of houses. [4]