The Remah in Yoreh Deah 160:9 (יורה דעה סימן קס סעיף ט) writes:
וְאִם אֶחָד מַלְוֶה מָעוֹת לַחֲבֵרוֹ עַל זְמַן מָה כְּדֵי שֶׁיַּחֲזֹר וְיַלְוֵהוּ פַּעַם אַחֶרֶת כַּזְּמַן הָרִאשׁוֹן, יֵשׁ אוֹמְרִים שֶׁאָסוּר (מָרְדְּכַי ס''פ א''נ וּתְשׁוּבַת הָרֹא''שׁ כְּלָל ק''ח סי' ט''ז) ... וְיֵשׁ אוֹמְרִים דְּמֻתָּר אִם אֵינוֹ מַלְוֶה לוֹ לִזְמַן אָרֹךְ יוֹתֵר מִמַּה שֶּׁהִלְוָהוּ
If someone lends money to his friend for a certain amount of time, [on condition] that he (the borrower) should lend him (the lender) money at another time, for the same amount of time as the first loan, There are those who say that this is forbidden (Mordechai beginning of Eizehu Neshech, and Teshuvos HaRosh 108:17).... Others say that it is permitted if he (the borrower, the second lender) does not lend him (back) for a longer time than he (the first lender) lent him.
The reason for the first opinion is, since the first loan is given with a condition that the lender receives in payment the principle of the loan itself, and additionally he should also receive a future loan from the current borrower. This second loan is considered ribbis (interest) on the first loan.
The management of a company with a large employee body decided to divide their paydays into two separate payroll groups. Half of the employees receive their paychecks on Friday at the end of the first and last week of every month, and the other half get paid on Friday at the end of the second and third (middle) week(s) of the month.
Two of the employees (with equal salaries), who were not in the same payrol group, decided to make an agreement between themselves as follows: On each payday, the employee who gets paid on that day, would share half his payment with the other employee. Thus, on each payday, each of the two employees would keep half of their salary and share half with his fellow employee.
According to the first opinion cited by the Rema is this permitted? Is the half of each salary shared with the coworker considered a loan given with a condition to pay it back the following week, and additionally to receive a return loan from him the third week, to be returned on the fourth payday etc.
Maybe it is just an agreement between the two employees that each one would only take half of his salary every week and have the other half paid to his coworker for his work.
Would it depend on whether the whole salary was first given to one employee, and he forwarded (by a pre-arranged agreement) to his co-worker, or if (by request of the two employees) half of each week's salary was forwarded directly from the employer to each of the two employees? Is the employer considered a messenger of each employee to lend half of his salary to his co-worker, and thus it might be forbidden even if the pay is given directly from the employer to each employee, or is each employee a messenger of the employer to pay his fellow co-worker every week, and thus it would be permitted even if the whole amount was first given to one employee and was given by him to his coworker? )