The 38-40 is an oddball and I am not sure how it got it’s name but I bet it has something to do with the fact that 41 Long Colt and 38-40 both share the same diameter barrels which is around .401-403.
The 41 Colt has been loaded with actual .385 hollow base bullets which expanded when fired to fill the bore. This is similar to how the .22 rimfires work. Interestingly the case on a .41 Colt is .41 Caliber.
Of course the 40 in 38-40 comes from the charge of 40 grains of black powder which it was originally loaded with. I guess whoever designs a cartridge gets to name it.
Many of the old western cartridges all basically referred to both the caliber and the powder charge. Thus the 38-40 was a Cal .38 bullet set over 40 grains of black powder. 32-20, 45-70, 50-90, are all the same.
Modern loading of the cartridges don't always use black powder. 45-70 can be found using the original specifications (for antique guns) or way hot designed for modern firearms. Inadvertent mixing can really ruin your day. ;)