It depends a bit on the states involved, but usually it's something along these lines:
1. Contact your insurance agent to obtain a binder (just call/stop in and give them the VIN, typically). This is their guarantee that they will cover you en route, and in my experience doesn't require paying them a fee.
2. Pay the seller, obtain the title signed over to you. If you have financing with the vehicle as collateral there may be some additional steps here since the lender would have a lien on the vehicle; I don't know how all those details work, but they (your bank) should be able to tell you.
3. Go to the DMV in the state you're buying in and get a transit permit (which may have a different name). Many/most states have these temporary registrations for just this sort of circumstance. Usually it's a very nominal fee; when I bought my motorhome out of state, New Hampshire charged me all of $10 If I recall. If tax is charged, keep the paperwork; often no tax is assessed for a transit permit.
4. Drive home, go to your local DMV, and get your title and registration, pay your taxes, and all that fun stuff. If you paid out of state taxes, most states will offset the amount paid against the tax they charge you.
5. Go to your favorite state inspection station and get a clean bill of health for your new vehicle.
The alternatives to a transit permit are not very good. You could drive on the previous owner's registration, if they let you, which is a liability quagmire. Alternately, once you have the title signed over, you can take the title, bill of sale, etc. to your DMV and get a registration etc., and they drive back and put the plates on the new vehicle, and then bring it home. You may need a certified odometer and/or VIN statement from e.g. a police officer or other official to get a registration without having the vehicle present.
There are exceptions. Massachusetts is particularly unhelpful as they neither issue transit permits nor recognize those from other states for their residents who are registering vehicles. I handled that by rejecting outright any vehicle being sold in Massachusetts when I was in the market as not being worth the hassle. In some cases you may be able to get a transit permit from the state you'll be returning to, I think.