Standards are experts common sense thoughts on the minimum safe ways to design, build and operate something. Standards are designed for voluntary use and do not impose any regulations.
However, laws and regulations may refer to certain standards and make compliance
with them compulsory.
A building code usually refers to multiple standards, with specific deviations for portions of the standard that does not apply.
Standards are universal, but building codes are local and can be enforced by local authorities.
The use of 'code' or 'standard' are interchangable because the standard forms the basic text for the code, but this does not mean 100% of any standard will apply to a code. This allows for corrections, deviations, new technology, etc. Over time these adjustments may or may not be incorporated into the standards.
The National Electrical Code (NEC) is a standard. States adopt a specific version of the NEC, which does not have to be the latest version and have deviations to deal with state-wide issues with the NEC version. Local authorities adopt statewise standards with state-wide deviations, adding local ammendments to deal with local issues as they are found.
This is a top-down, bottom-up approach. Standards come from the top, but issues with these standards are found/tweaked at the local level. Local can only change local. Local ammendments will drive state ammendments, which may drive national changes. Hence, revisions of NEC.