An update, if I remove that permission line from the config.php file and let XenForo create attachment folders with 0777 permission, along with all files located inside them e.t.c (default as should be). When you delete an attachment from a thread it still remains there in the attachment folders.
That seems odd, because if I delete an avatar using folders with 755 permission and image using 644 permission. The avatars are still deleted from the avatar folder on the server. Tried exactly the same permission set-up with attachments folders and files (same as avatar folder and image files). Yet still, attachments don't get deleted from server. Tried all sorts of different ways now using many different permission methods. Always the same story - attachment files remain on the server not deleted.