Federal(IRS) & State(NY Income and Sales Tax ) Leins

Do Federal and State tax leins stay with the property after the 1st mortgage forecloses and the prpperty is sold at foreclosure auction?