No, STRING_AGG is only implemented as an aggregate function (at time of writing) with support for the WITHIN GROUP clause, it cannot be windowed (using an OVER clause). You will need to use a subquery/CTE/derived table:
SELECT YT.YourID,
YT.YourGroupingColumn,
DT.AggregatedString
FROM dbo.YourTable YT
OUTER APPLY (SELECT STRING_AGG(YourAggregatingColumn,',') AS AggregatedString
FROM dbo.YourTable sq
WHERE sq.YourGroupingColumn = YT.YourGroupingColumn) DT;
SELECT YT.YourID,
YT.YourGroupingColumn,
DT.AggregatedString
FROM dbo.YourTable YT
LEFT JOIN (SELECT sq.YourGroupingColumn,
STRING_AGG(sq.YourAggregatingColumn,',') AS AggregatedString
FROM dbo.YourTable sq
GROUP BY sq.YourGroupingColumn) DT ON YT.YourGroupingColumn = DT.YourGroupingColumn;
WITH Agg AS(
SELECT sq.YourGroupingColumn,
STRING_AGG(sq.YourAggregatingColumn,',') AS AggregatedString
FROM dbo.YourTable sq
GROUP BY sq.YourGroupingColumn)
SELECT YT.YourID,
YT.YourGroupingColumn,
A.AggregatedString
FROM dbo.YourTable YT
LEFT JOIN Agg A ON YT.YourGroupingColumn = A.YourGroupingColumn;
With no sample data, I can't test what would be most performant for you; you will need to do that off your own back (I expect the CTE and Derived table to have very similar, if not identical, query plans though).