A 17th century mansion modelled on an Islamic palace has hit the market for just under £5m.