"the U.K. is a net contributor,"
but Wales is a net beneficiary.
I'm a Remainer living in Cardiff. My constituency voted 70% Remain and Cardiff as a whole 60%. What you saw in Cardiff is not typical. We had a big rally last weekend in favour of the EU.
You have to take into account that the Welsh media is very weak. Many more people in Wales read the Daily Mail than do the Western Mail, which is extremely pro-Remain.
The reasons for the leave vote were similar to the reasons in England. Because of this lack of media, many Welsh people don't even know we're a net beneficiary. Some of the people living in the areas that have received funding don't necessarily like what it's been spent on and blame the EU, even though the decisions are made locally. Some are afraid of immigrants coming to steal their jobs. You can see that this is fear rather than reality as the highest leave votes came from areas with very, very few immigrants such as Blaenau Gwent. However, it's easy to divide people who are poor and some are looking for a group to blame so 'they're taking your jobs' or 'they're undercutting your wages' works with worried people in deprived areas.
Also, as someone mentioned above, many English immigrants into Wales voted to leave and this had an effect on the vote result (Oxford uni research by Prof Dorling).
Some of the areas with the highest Welsh identity, Gwynedd and Ceredigion voted Remain. There is research by Cardiff Uni on identity and vote i.e. people who feel more Welsh, voted Remain, Welsh and British voted leave, etc.
Google a video of Nick Clegg visiting Blaenau Gwent to discuss it. Or even the video with Femi in Scunthorpe, which is not in Wales, but where some of the issues are similar.