Postresql, max returns all rows with same ids
If using a non-standard PostgreSQL construct is no problem, the easiest way would be

SELECT DISTINCT ON (product_id)
       product_id, store_id, available_count
FROM j_product_store_availability
ORDER BY product_id, available_count DESC, store_id;