On average, nails are more cost-effective for most wood framing than are screws, and that’s the overwhelming reason they are used, particularly in a typical stick-built wood-framed house. Not only are they cheaper and easier to place (with either a hammer or a nail gun); they are cheaper and easier to remove if a minor on-the-spot adjustment needs to be made. A few seconds per fastener adds up when thousands of fasteners need to be applied.
Nails have some specific advantages. They are usually made of drawn wire which is stronger in shear* strength than a screw of the same outside dimension. Screws, as mentioned above, are typically more brittle. If you were to compare a 3 1/2" drywall screw to a 16d nail you would see a substantial difference in shear strength. The screw has a shaft narrower than the nail, and the material is much more brittle. Of course you can get screws that are much stronger than drywall screws, but as the material changes, the cost rises rapidly. (Note that such a “drywall screw” is a description of the type of screw and not a description of its use; screws used for drywall are much shorter.) A nailed joint can also be tweaked into position with a hammer. Nails are usually constructed of bendable metals (much more generous electrons, I assume; ask Stranger) and the resulting malleability is quite useful. A screwed joint is well… screwed if it’s even marginally out of position. The screw will snap or the wood will split if you start tapping around a screwed joint because screws are not usually made of very deformable metals.
Any framed home could be built entirely with screws, and if the right screws were chosen it would be stronger assuming they were placed with expertise. And there’s another rub. Most homes are built by crews who work under a crew boss who works for a sub-contractor who bids out to the general contractor–and there is no requirement that any of them have any formal training. Licenses, yes. But most framers do their job a certain way because that’s how they were taught. Screws over here; nails over there. Neither the workers themselves nor even contractors are a good source of information on why and how a particular solution is better.
Because stick-built houses assume certain materials will be used, construction standards tend to reflect the available cost-effective materials rather than reinventing the basic framing techniques. As an example, a nailing plate or hurricane tie (or adhesive) might be used where an alternate method such as screws or bolts could in theory provide an equivalent binding strength.
A joist is best and most easily secured into a box beam with nails, even if lag screws would work. A big old nail has a lot of shear strength; doesn’t split the wood without pre-drilling, and sits flush for the sheathing. And it’s cheaper by a wide margin. Binding strength is not an issue because the decking nailed on top of the box beam and the joists will bind the joist/box joint. Drywall is best and relatively easily glued and screwed. Subflooring? Almost always nailed (along with adhesive) but definitely better screwed if you don’t trust the adhesive over time and you don’t want squeaky floors.
On average, I’d say, nails are over-used and used poorly. On the other hand, most construction codes over-build for typical loads. We don’t see too many houses falling over. They just sorta loosen up and crack here and there. The quality of the craftsmanship and materials is usually more of a factor than the choice of fastener.
*Probably not technically shear, but perpendicular stress…