All foreclosure properties are listed through agents after the auction as REO or real estate owned. At that point the owner is the bank.
Of course you can still get a contract just make the offer through the realtor. The realtor gets paid by the bank when you buy the house. If you sell the house after you’ve purchased it the only way the realtor gets paid is if you have listed the property with the realtor.
Your contract would be between you and the owner. The realtor has a listing agreement with the owner. The agreement between the owner and the realtor is different than any contract/agreement you would have with the owner. The realtor agrees to market the property. You would be agreeing to purchase the property.