By a new GM crate or build one yourself
If you buy a NAPA, Autozone, or other autoparts motor, you better be saving the cost of labor of removing it and reinstalling over the cost of a GM crate motor.
If you are strapped for cash, buy a junk yard car from a rollover or from a rearend collision. You can save money by buying a low cost engine that has been broken in. You do have to consider the condition of the seals and such and how the engine was stored since it was taken out of service.
There are over a 100 rebuilt engine factories in the US. They sort out old internals to specifiation and rebuild engines from the core parts. Most of the time you get what you pay for, but some of the time the engines have a problem and you get to remove and reinstall and pay freight a second time. I have not heard any thing bad about a GM crate motor and they don't cost that much more.
If you have some mechanical ability, you can build your own, but it is pretty doubtful that on the first one you will be ahead of the game vs a crate motor.