Ghee freezes from the bottom but water from the top. Why?

We know that the density of solid ghee is more than that of liquid or hot ghee. So while freezing, all the frozen ghee starts to displace to the bottom. But, water has a higher density at 40C than at 00C. It means water has a higher density than ice. So, while freezing, ice displaces to the top.