Someone else will hopefully provide some historical evidence. I don't have that to offer.

For my thinking, this connotation comes from the distinction between (a) what something is in name, that is, as set forth in a definition or specification and (b) what a given occurrence of that something is in concrete reality.

The "2-by-4" and other examples cited so far fit this. It especially makes sense for contexts, such as standards, where a name or symbol is invented or formally ascribed to a definition that the standards body formulates.

Such a definition sets forth what something is in name, or nominally. For a given occurrence to fit that name the definition must be matched in some way, often within tolerances specified in the definition.

If it fits then it can be called by that name - it is nominally such a thing. This is the case even if according to some other considerations one might normally not think of it as being such a thing.

It may help to think of the expression at least in name or even in name only.

Those Republicans on the far right of the American political spectrum sometimes criticize centrist Republicans as being "RINO"s (rhinos): R epublican I n N ame O nly. From their point of view the centrists are only nominally Republican, that is, according the definition of being enrolled in the party. They do not consider them to be really Republican, that is, Republican in spirit or actual practice.

The point is this: Use of the word nominally in such contexts emphasizes the possibility or actuality of a discrepancy between (a) the meaning of the name as formally or defined or as normally/conventionally understood and (b) the meaning of some individuals or occurrences that are classified under that name.

Some things called a given name do not, in some sense, seem to really correspond to what one thinks of as what that name means. There is some difference -- in some sense the name does not really seem to fit.

(This difference is close to what is meant by the letter of the law versus the spirit of the law. The former is the nominal meaning of the law.)