Find out who the attorney was handling the foreclosure. Contact that individual directly and ask if they would be willing to get a hold of their contact at the bank and find out if the bank would be willing to do an "assignment" of the property to you and include how much you are willing to pay (this is usually not an negotiation so go in with your best offer). Most won't (especially the big banks). But some will depending on how much LTV is, current market sales, additional fees they are looking at etc. (basically additional time and money before they will have it off their hands)
If you get a yes back, contact a GOOD real estate attorney and have him draw up the assignment (speak with him/her first and get the correct name of the assignment form as this varies slightly in some states....and be SURE he knows EXACTLY which one you are referring to).
It also depends from state to state if there is a redemption period for the Deed of Trust or the Mortgage and which one the lien was. If there is a redemption period, you can have this done the day before the end of the redemption period, it's just a different form.