Housing association was not a charity, appeal judges rule