Locals are being priced out of villages and towns in north and west Wales as second home owners snap up coastal properties.