Environmental change is frequent. To adjust and survive, animals need behavioural flexibility. Recently, cognitive flexibility has emerged as a driving force for adjusting to environmental change. Understanding how environmental factors, such as food quality, influence behavioural and/or more costly cognitive flexibility. Here, we investigate the effects of high-quality versus standard food as well as the effects of different housing conditions on both types of flexibility. Our results show that mice that experienced a poorer diet under seminatural conditions showed greater behavioural but not cognitive flexibility. For cage-housed mice, the results were less clear. However, mice fed a poorer diet performed better in innovative problem-solving, thus showing enhanced cognitive flexibility, which was not apparent in the reversal learning paradigm. The observed differences were most likely due to differences in motivation to obtain food rewards. Additionally, animals on poorer diet had lower brain volume, usually related to lower cognitive task performance at the between-species level. Thus, our study emphasises the importance of environmental conditions on behavioural flexibility at the within-species level, highlights that different test paradigms may lead to different conclusions, and finally shows that cage housing of wild animals may lead to patterns that do not necessarily reflect natural conditions.