The short answer to your basic questions is yes. A corporation is a legal entity all its own. In general, when you buy an aged shelf corporation, you are purchasing all the shares of stock from the person who founded/set-up the company, and you thereby become the new owner. In most instances, whatever assets, liabilities, credit, and debt the corporation has will remain with it.
In most cases, the older the corporation is, the more credit it has, and the "cleaner" its history, the more it's worth -- and the more it will cost you. There are lots of attorneys in "business friendly" states that routinely create and sell aged shelf corporations -- so it's a legitimate type of offering. However, there are also some enterprises that sell aged corporations and add in lots of fees and upsells in the process -- they tell you about them very clearly in the fine print, but a lot of people fail to read it.
For example, one firm that pitches its services on this website offers a two year old shelf corporation with a bank account and limited line of credit for $5,000. After you pay that, they tell you that for $2,500 more, they can get you a three year old company instead with a S&P listing and a D&B rating -- it's even already on the federal government's list of approved bidders and contractors! Sounds good, so you pony up the extra bucks.
They acquire the company, amend the corporate filing to transfer the stock/firm to you, and offer to establish a $100,000 line of credit. "Is that satisfactory?" they ask (explaining that more is better and why not get a $500,000 line of credit if you can?). You go for it, and they set up the half-million dollar line of credit . . . and then bill you immediately for the fee that is just as plain as day in the terms and conditions -- 5 percent of the amount of the credit line they obtain for you. In other words, you now owe them $32,500 (that's accruing interest at loan shark rates), yet your business hasn't even opened or made a penny in revenue yet.
There are probably some "can't miss" start-up business scenarios where doing this might make sense . . . but not many in my opinion. Bottom line: Be careful who you deal with, and be sure to read (and understand) what you're getting into.
Welcome to the community and good luck.