### Summary

Setting file permissions for a list of files like this
```
my_items:
  - path: dir1
    mode: 0770
  - ... further entries ..
```

using `ansible.builtin.file` results in incorrect permissions. For details see steps to reproduce below. 

### Issue Type

Documentation Report

### Component Name

file

### Ansible Version

```console
$ ansible --version
ansible [core 2.12.6]
  config file = /home/yannik/projects/xxx/ansible.cfg
  configured module search path = ['/home/yannik/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/yannik/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.6 (main, Aug  2 2022, 00:00:00) [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)]
  jinja version = 3.0.1
  libyaml = True
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
ANSIBLE_NOCOWS(/home/yannik/projects/xxx/ansible.cfg) = True
```


### OS / Environment

fedora 35

### Steps to Reproduce

Create a host_vars file with this:
```yaml
my_items:
  - path: dir1
    mode: 0770
```

and run the following playbook:
```yaml (paste below)
- file:
    path: "/tmp/{{ item.path }}"
    state: directory
    mode: "{{ item.mode }}"
  loop: "{{ my_items }}"
```


### Expected Results

The resulting permissions of `/tmp/dir1` should be equal to the permissions being set when not using a loop:

### Specifying `mode` directly in the playbook task
```
- file:
    path: "/tmp/dir1"
    state: directory
    mode: 0770
```
**Result: permissions set to 0770**

### Specifying `mode` using a variable
`hosts_vars`: 
```
my_permissions_variable: 0770
```
playbook:
```
- file:
    path: "/tmp/dir"
    state: directory
    mode: "{{ my_permissions_variable }}"
```

**Result: permissions set to 0770**


### Actual Results

```console
File permissions are set to `0504` instead of `0770` when using a loop:

$ ansible-playbook test.yml -v         
Using /home/yannik/projects/xxx/ansible.cfg as config file

PLAY [app0] *************************************************************************************************

TASK [Gathering Facts] **************************************************************************************
ok: [app0]

TASK [file] *************************************************************************************************
ok: [app0] => (item={'path': 'dir1', 'mode': 504}) => changed=false 
  ansible_loop_var: item
  gid: 0
  group: root
  item:
    mode: 504
    path: dir1
  mode: '0504'
  owner: root
  path: /tmp/dir1
  size: 4096
  state: directory
  uid: 0

PLAY RECAP **************************************************************************************************
app0                       : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


$ stat /tmp/dir1
  File: /tmp/dir1
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: fe01h/65025d	Inode: 2126076     Links: 2
Access: (0504/dr-x---r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-09-06 14:28:46.635247941 +0200
Modify: 2022-09-06 14:28:46.635247941 +0200
Change: 2022-09-06 14:28:46.635247941 +0200
 Birth: 2022-09-06 14:28:46.635247941 +0200
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
type: str
  selevel:
    description:
    - The level part of the SELinux filesystem object context.
    - This is the MLS/MCS attribute, sometimes known as the C(range).
    - When set to C(_default), it will use the C(level) portion of the policy if available.
    type: str
  unsafe_writes:
    description:
    - Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target filesystem object.
    - By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target filesystem objects,
      but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted filesystem objects,
      which cannot be updated atomically from inside the container and can only be written in an unsafe manner.
    - This option allows Ansible to fall back to unsafe methods of updating filesystem objects when atomic operations fail
      (however, it doesn't force Ansible to perform unsafe writes).
    - IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption.
    type: bool
    default: no
    version_added: '2.2'
  attributes:
    description:
    - The attributes the resulting filesystem object should have.
    - To get supported flags look at the man page for I(chattr) on the target system.
    - This string should contain the attributes in the same order as the one displayed by I(lsattr).
    - The C(=) operator is assumed as default, otherwise C(+) or C(-) operators need to be included in the string.
    type: str
    aliases: [ attr ]
    version_added: '2.3'
'''