One other way is a correlated query using exists which should be very performant:
select * from #Product p where exists ( select * from #Product p2 where p2.ProductNumber = p.ProductNumber group by p2.productNumber having Min(p2.productType) = 1 and Max(p2.productType) = 5 ); Demo DB<>Fiddle