Maybe both the passenger and the airline followed the legal requirements, but the immigration authorities took a dislike to your appearance, or whether you used a national vs UNLP passport, or he/she doesn't care for your most recent choice of residence. Apparently one can be refused entry despite meeting legal requirements.