I was reading about ancient Russian izba buildings and it said that builders usually didn’t use nails because metal was expensive. Why is that?
That's not actually a problem unique to the Slavs. Metal of any kind was expensive to all societies because the mining, smelting, and forging process was labor intensive.
Houses and other buildings don't actually require that much metal in things like fasteners because timber framing can be done without it.
The explanation is not necessarily correct, as the typical rural Russian houses build of squared or round logs using the simple gable-and-purlin roof support (rus. самцово-слеговaя крыша) were build in a similar way from at least 5th to 20th century, thus the availability of metal elements could not have been a discerning factor. But indeed, as already said, metal was quite expensive due to the labour-intensive methods of ore excavation and processing.
Although the question mentions Russian buildings as 'izba' is a Russian word meaning any wooden rural house, there were distinct similarities between the East and West Slavic buildings reaching back as early as the Lusitian culture i.e. 14th-5th century BCE. As evidenced by the Iron Age settlements excavated in Central Europe, houses were constructed in similar way for almost 2500 years. This can be seen in the settlements like Biskupin in Poland or Kemberg in Germany, where the houses display similar traits to Russian rural buildings, although log variant of the post-and-plank wall construction seems to be preferred in that region, what is partially explained by the prevalence of the longhouses rather than single huts.
In the early Middle Ages in the nortwestern Russia, especially in Russian Karelia, majority of found iron bloomeries are thought to have used bog iron and lake iron that is relatively abundant in that region. Now, the iron was relatively rare everywhere across early medieval Europe and the process of ironworking was labour-intensive, iron and steel objects were nowhere near as ubiquitous as it is today and were usually limited to the items that required to display the balance between size and durability, such as horseshoes, knives, hammers, axes, locks, hinges, weapons, armour etc. This caused people to resort to different materials in construction of the everyday items, what in very heavily forested Eastern Europe made wood a natural first choice. This was also reflected throughout Europe, where metal items were used rather sparingly in rural construction and most farming implements were constructed only of wood making carpentry a very sought-after specialization.
There is also one important factor that needs to be addressed, namely the climate in this particular part of Europe. Novgorod, Kievan Rus, and to some extent also Lithuania and Poland are heavily forested areas experiencing large yearly temperature amplitudes reaching 50-60 degrees, resulting in hot, humid summers and cold, snowy winters. These factors made an already abundant large trees a good choice for a main building material as thick lumber is a good thermal insulator and the log houses proving a great compromise between the functionality, availability and simplicity of construction. Incidentally, log cabins with the simplest gable-and-purlin roof construction do not require any intricate carpentry or additional reinforcement due to large sizes of the elements used, making metal fastenings relatively unnecessary. This is also true for the post-and-plank wall construction also popular in the Slavic lands until early 20th century. Furthermore, humid summers and snowy winters meant a substantial contact of housing materials with water, what with the lack of stainless steel made metal elements not that useful as one might have thought. And once the pattern have been set, it remained for many centuries, as there was little incentive to change the construction methods if the existing ones were simple, cheap and effective.